From 9d628dc3575a797417bd085f6058dfedf4c2a1cc Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Sat, 26 Feb 2022 17:39:59 +0100 Subject: [PATCH] always use select2 with initialize_methods --- app/models/additionals_query.rb | 47 +++++---------------------------- lib/additionals.rb | 4 --- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/app/models/additionals_query.rb b/app/models/additionals_query.rb index 4d01ce10..b4a2d974 100644 --- a/app/models/additionals_query.rb +++ b/app/models/additionals_query.rb @@ -139,47 +139,20 @@ module AdditionalsQuery end def initialize_author_filter(position: nil) - if Additionals.user_with_select2? - add_available_filter 'author_id', order: position, - type: :author - else - add_available_filter 'author_id', order: position, - type: :list_optional, - values: -> { author_values } - end + add_available_filter 'author_id', order: position, + type: :author end def initialize_assignee_filter(position: nil) - if Additionals.user_with_select2? - add_available_filter 'assigned_to_id', order: position, - type: :assignee - else - add_available_filter 'assigned_to_id', order: position, - type: :list_optional, - values: -> { assigned_to_all_values } - end + add_available_filter 'assigned_to_id', order: position, + type: :assignee end def initialize_watcher_filter(position: nil) return unless User.current.logged? - if Additionals.user_with_select2? - add_available_filter 'watcher_id', order: position, - type: :user_with_me - else - add_available_filter 'watcher_id', order: position, - type: :list, - values: -> { watcher_values_for_manage_public_queries } - end - end - - # issue independend values. Use assigned_to_values from Redmine, if you want it only for issues - def assigned_to_all_values - assigned_to_values = [] - assigned_to_values << label_me_value if User.current.logged? - assigned_to_values += principals.sort_by(&:status).collect { |s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")] } - - assigned_to_values + add_available_filter 'watcher_id', order: position, + type: :user_with_me end # not required for: assigned_to_id author_id user_id watcher_id updated_by last_updated_by @@ -196,14 +169,6 @@ module AdditionalsQuery values end - # watcher_values of query checks view_issue_watchers, this checks manage_public_queries permission - # and with users (not groups) - def watcher_values_for_manage_public_queries - watcher_values = [label_me_value] - watcher_values += users.collect { |s| [s.name, s.id.to_s] } if User.current.allowed_to? :manage_public_queries, project, global: true - watcher_values - end - def sql_for_watcher_id_field(field, operator, value) watchable_type = queried_class == User ? 'Principal' : queried_class.to_s diff --git a/lib/additionals.rb b/lib/additionals.rb index c4fa6fc2..bcf696a9 100644 --- a/lib/additionals.rb +++ b/lib/additionals.rb @@ -77,10 +77,6 @@ module Additionals ids.take limit end - def user_with_select2? - AdditionalsPlugin.active_hrm? - end - def debug(message = 'running', console: false) if console RedminePluginKit::Debug.msg message