diff options
-rw-r--r-- | app/models/issue_custom_field.rb | 2 | ||||
-rw-r--r-- | app/models/mail_handler.rb | 2 | ||||
-rw-r--r-- | app/models/project_custom_field.rb | 2 | ||||
-rw-r--r-- | app/models/query.rb | 2 | ||||
-rw-r--r-- | app/models/time_entry_custom_field.rb | 2 | ||||
-rw-r--r-- | app/models/version_custom_field.rb | 2 | ||||
-rw-r--r-- | config/initializers/10-patches.rb | 2 | ||||
-rw-r--r-- | lib/redmine/acts/positioned.rb | 2 | ||||
-rw-r--r-- | lib/redmine/helpers/gantt.rb | 2 | ||||
-rw-r--r-- | lib/redmine/wiki_formatting.rb | 2 | ||||
-rw-r--r-- | test/functional/issues_custom_fields_visibility_test.rb | 2 |
11 files changed, 11 insertions, 11 deletions
diff --git a/app/models/issue_custom_field.rb b/app/models/issue_custom_field.rb index 8363bc397..ae460e221 100644 --- a/app/models/issue_custom_field.rb +++ b/app/models/issue_custom_field.rb @@ -29,7 +29,7 @@ class IssueCustomField < CustomField end def visible_by?(project, user=User.current) - super || (roles & user.roles_for_project(project)).present? + super || roles.intersect?(user.roles_for_project(project)) end def visibility_by_project_condition(project_key=nil, user=User.current, id_column=nil) diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 2cbc8a5c7..b6858d96a 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -398,7 +398,7 @@ class MailHandler < ActionMailer::Base if options.key?(:override) options[:override] else - (handler_options[:allow_override] & [attr.to_s.downcase.gsub(/\s+/, '_'), 'all']).present? + handler_options[:allow_override].intersect?([attr.to_s.downcase.gsub(/\s+/, '_'), 'all']) end if override && (v = extract_keyword!(cleaned_up_text_body, attr, options[:format])) v diff --git a/app/models/project_custom_field.rb b/app/models/project_custom_field.rb index 6c11b225f..1816f5060 100644 --- a/app/models/project_custom_field.rb +++ b/app/models/project_custom_field.rb @@ -23,7 +23,7 @@ class ProjectCustomField < CustomField end def visible_by?(project, user=User.current) - super || (roles & user.roles_for_project(project)).present? + super || roles.intersect?(user.roles_for_project(project)) end def visibility_by_project_condition(project_key=nil, user=User.current, id_column=nil) diff --git a/app/models/query.rb b/app/models/query.rb index 0f8793122..4e0088174 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -417,7 +417,7 @@ class Query < ApplicationRecord true when VISIBILITY_ROLES if project - (user.roles_for_project(project) & roles).any? + user.roles_for_project(project).intersect?(roles) else user.memberships.joins(:member_roles).where(:member_roles => {:role_id => roles.map(&:id)}).any? end diff --git a/app/models/time_entry_custom_field.rb b/app/models/time_entry_custom_field.rb index 69dcce59d..d52f7fc31 100644 --- a/app/models/time_entry_custom_field.rb +++ b/app/models/time_entry_custom_field.rb @@ -23,7 +23,7 @@ class TimeEntryCustomField < CustomField end def visible_by?(project, user=User.current) - super || (roles & user.roles_for_project(project)).present? + super || roles.intersect?(user.roles_for_project(project)) end def validate_custom_field diff --git a/app/models/version_custom_field.rb b/app/models/version_custom_field.rb index 075bbe675..6f7dd1a50 100644 --- a/app/models/version_custom_field.rb +++ b/app/models/version_custom_field.rb @@ -23,6 +23,6 @@ class VersionCustomField < CustomField end def visible_by?(project, user=User.current) - super || (roles & user.roles_for_project(project)).present? + super || roles.intersect?(user.roles_for_project(project)) end end diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index 716330641..04081c333 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -96,7 +96,7 @@ end module ActionView LookupContext.prepend(Module.new do def formats=(values) - if (Array(values) & [:xml, :json]).any? + if Array(values).intersect?([:xml, :json]) values << :api end super diff --git a/lib/redmine/acts/positioned.rb b/lib/redmine/acts/positioned.rb index adcbac8b9..efb9d2d60 100644 --- a/lib/redmine/acts/positioned.rb +++ b/lib/redmine/acts/positioned.rb @@ -100,7 +100,7 @@ module Redmine end def position_scope_changed? - (saved_changes.keys & self.class.positioned_options[:scope].map(&:to_s)).any? + saved_changes.keys.intersect?(self.class.positioned_options[:scope].map(&:to_s)) end def shift_positions diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index 6802c4342..ad676ec6f 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -768,7 +768,7 @@ module Redmine children = object.leaf? ? [] : object.children & project_issues(object.project) has_children = children.present? && - (children.collect(&:fixed_version).uniq & [object.fixed_version]).present? + children.collect(&:fixed_version).uniq.intersect?([object.fixed_version]) when Version tag_options[:id] = "version-#{object.id}" tag_options[:class] = "version-name" diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index cc68e9972..558d3e117 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -103,7 +103,7 @@ module Redmine # Returns true if the text formatter supports single section edit def supports_section_edit? - (formatter.instance_methods & ['update_section', :update_section]).any? + formatter.instance_methods.intersect?(['update_section', :update_section]) end # Returns a cache key for the given text +format+, +text+, +object+ and +attribute+ or nil if no caching should be done diff --git a/test/functional/issues_custom_fields_visibility_test.rb b/test/functional/issues_custom_fields_visibility_test.rb index 0e9712438..c19872134 100644 --- a/test/functional/issues_custom_fields_visibility_test.rb +++ b/test/functional/issues_custom_fields_visibility_test.rb @@ -381,7 +381,7 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest assert_response :found users_to_test.each do |user, fields| mails = ActionMailer::Base.deliveries.select {|m| m.to.include? user.mail} - if (fields & [@field2, @field3]).any? + if fields.intersect?([@field2, @field3]) assert_equal 1, mails.size, "User #{user.id} was not notified" else assert_equal 0, mails.size, "User #{user.id} was notified" |