diff --git a/app/helpers/filters_helper.rb b/app/helpers/filters_helper.rb index b185233f4..d8a57dfc1 100644 --- a/app/helpers/filters_helper.rb +++ b/app/helpers/filters_helper.rb @@ -12,7 +12,7 @@ module FiltersHelper end def any_filters?(filter) - filter.tags.any? || filter.assignees.any? || filter.assigners.any? || + filter.tags.any? || filter.assignees.any? || filter.creators.any? || filter.stages.any? || filter.terms.any? || filter.assignment_status.unassigned? || !filter.default_indexed_by? end diff --git a/app/models/filter.rb b/app/models/filter.rb index 1fc09f68b..809e781a2 100644 --- a/app/models/filter.rb +++ b/app/models/filter.rb @@ -22,7 +22,7 @@ class Filter < ApplicationRecord result = result.active unless indexed_by.popped? result = result.unassigned if assignment_status.unassigned? result = result.assigned_to(assignees.ids) if assignees.present? - result = result.assigned_by(assigners.ids) if assigners.present? + result = result.where(creator_id: creators.ids) if creators.present? result = result.in_bucket(buckets.ids) if buckets.present? result = result.in_stage(stages.ids) if stages.present? result = result.tagged_with(tags.ids) if tags.present? diff --git a/app/models/filter/params.rb b/app/models/filter/params.rb index bc617a17a..c09edb074 100644 --- a/app/models/filter/params.rb +++ b/app/models/filter/params.rb @@ -5,7 +5,7 @@ module Filter::Params :assignment_status, :indexed_by, assignee_ids: [], - assigner_ids: [], + creator_ids: [], bucket_ids: [], stage_ids: [], tag_ids: [], @@ -41,7 +41,7 @@ module Filter::Params params[:bucket_ids] = buckets.ids params[:stage_ids] = stages.ids params[:assignee_ids] = assignees.ids - params[:assigner_ids] = assigners.ids + params[:creator_ids] = creators.ids end.compact_blank.reject(&method(:default_value?)) end diff --git a/app/models/filter/resources.rb b/app/models/filter/resources.rb index dabeac4f7..a7df5ab69 100644 --- a/app/models/filter/resources.rb +++ b/app/models/filter/resources.rb @@ -6,7 +6,7 @@ module Filter::Resources has_and_belongs_to_many :buckets has_and_belongs_to_many :stages, class_name: "Workflow::Stage", join_table: "filters_stages" has_and_belongs_to_many :assignees, class_name: "User", join_table: "assignees_filters", association_foreign_key: "assignee_id" - has_and_belongs_to_many :assigners, class_name: "User", join_table: "assigners_filters", association_foreign_key: "assigner_id" + has_and_belongs_to_many :creators, class_name: "User", join_table: "creators_filters", association_foreign_key: "creator_id" end def resource_removed(resource) diff --git a/app/models/filter/summarized.rb b/app/models/filter/summarized.rb index 3e954e51c..559b3bc6b 100644 --- a/app/models/filter/summarized.rb +++ b/app/models/filter/summarized.rb @@ -1,6 +1,6 @@ module Filter::Summarized def summary - [ index_summary, tag_summary, assignee_summary, assigner_summary, stage_summary, terms_summary ].compact.to_sentence + " #{bucket_summary}" + [ index_summary, tag_summary, assignee_summary, creator_summary, stage_summary, terms_summary ].compact.to_sentence + " #{bucket_summary}" end private @@ -22,12 +22,6 @@ module Filter::Summarized end end - def assigner_summary - if assigners.any? - "assigned by #{assigners.pluck(:name).to_choice_sentence}" - end - end - def stage_summary if stages.any? "staged in #{stages.pluck(:name).to_choice_sentence}" @@ -45,4 +39,10 @@ module Filter::Summarized "matching #{terms.map { |term| %Q("#{term}") }.to_sentence}" end end + + def creator_summary + if creators.any? + "added by #{creators.pluck(:name).to_choice_sentence}" + end + end end diff --git a/app/views/filters/_assigners.html.erb b/app/views/filters/_creators.html.erb similarity index 57% rename from app/views/filters/_assigners.html.erb rename to app/views/filters/_creators.html.erb index 8c03625b1..aa8befe24 100644 --- a/app/views/filters/_assigners.html.erb +++ b/app/views/filters/_creators.html.erb @@ -1,47 +1,49 @@ -<% if filter.assigners.any? %> -