From fb57eaec64cfc4ab539e6103323c5d26b49f612e Mon Sep 17 00:00:00 2001 From: kumarin Date: Mon, 13 Jul 2026 10:13:12 +0530 Subject: [PATCH] OTWO-4919 Edit page search not working for enist and rss --- app/models/edit.rb | 2 +- test/controllers/edits_controller_test.rb | 8 ++++++++ test/helpers/edits_helper_test.rb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/edit.rb b/app/models/edit.rb index 4dd57bda2..94ee1ebdd 100644 --- a/app/models/edit.rb +++ b/app/models/edit.rb @@ -16,7 +16,7 @@ class Edit < ApplicationRecord scope :for_target, ->(target) { where(target_type: target.class.to_s, target_id: target.id) } scope :for_editor, ->(editor) { where(account_id: editor.id) } scope :for_ip, ->(ip) { where(ip: ip) } - filterable_by %w[key value] + filterable_by %w[key value target_type] def previous_value previous_edit.try(:value) diff --git a/test/controllers/edits_controller_test.rb b/test/controllers/edits_controller_test.rb index a7bd0d320..dd15853ec 100644 --- a/test/controllers/edits_controller_test.rb +++ b/test/controllers/edits_controller_test.rb @@ -42,6 +42,14 @@ class EditsControllerTest < ActionController::TestCase end end + it 'index should find rss subscription edits by searching target_type' do + login_as nil + rss_edit = CreateEdit.where(target_type: 'RssSubscription', project_id: @project.id).first + get :index, params: { project_id: @project.to_param, query: 'rsssubscription' } + assert_response :ok + assert assigns(:edits).map(&:id).include?(rss_edit.id) + end + # update action it 'undo should require a logged in user' do login_as nil diff --git a/test/helpers/edits_helper_test.rb b/test/helpers/edits_helper_test.rb index cabc389c6..2a295bf4b 100644 --- a/test/helpers/edits_helper_test.rb +++ b/test/helpers/edits_helper_test.rb @@ -16,7 +16,7 @@ class EditsHelperTest < ActionView::TestCase it 'drop the year if it was this year' do other_time = 17.days.ago dont_fail_around_new_years_date = Time.new(Time.current.year, other_time.month, other_time.day).in_time_zone - _(edit_humanize_datetime(dont_fail_around_new_years_date)).wont_match Time.current.year + _(edit_humanize_datetime(dont_fail_around_new_years_date)).wont_match Time.current.year.to_s end it 'includes the year if it was before this year' do