diff options
author | Go MAEDA <maeda@farend.jp> | 2024-01-08 01:04:37 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-01-08 01:04:37 +0000 |
commit | 52a55f407b74815c13675f4176570b8a952d7b75 (patch) | |
tree | 0ec4550df5a3e31b70432a99b29228fb05b130e0 /app/models | |
parent | 4d3fc7f89ec7f3d121b64ccb7d7b45dcf5827363 (diff) | |
download | redmine-52a55f407b74815c13675f4176570b8a952d7b75.tar.gz redmine-52a55f407b74815c13675f4176570b8a952d7b75.zip |
Replace String#sub with delete_prefix / delete_suffix (#40008).
Patch by Go MAEDA (@maeda).
git-svn-id: https://svn.redmine.org/redmine/trunk@22596 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/issue_query.rb | 4 | ||||
-rw-r--r-- | app/models/query.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index 21552dfd6..7c1027ad3 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -328,7 +328,7 @@ class IssueQuery < Query :sortable => "#{Issue.table_name}.is_private", :groupable => true) end - disabled_fields = Tracker.disabled_core_fields(trackers).map {|field| field.sub(/_id$/, '')} + disabled_fields = Tracker.disabled_core_fields(trackers).map {|field| field.delete_suffix('_id')} disabled_fields << "total_estimated_hours" if disabled_fields.include?("estimated_hours") @available_columns.reject! do |column| disabled_fields.include?(column.name.to_s) @@ -479,7 +479,7 @@ class IssueQuery < Query def sql_for_notes_field(field, operator, value) subquery = "SELECT 1 FROM #{Journal.table_name}" + " WHERE #{Journal.table_name}.journalized_type='Issue' AND #{Journal.table_name}.journalized_id=#{Issue.table_name}.id" + - " AND (#{sql_for_field field, operator.sub(/^!/, ''), value, Journal.table_name, 'notes'})" + + " AND (#{sql_for_field field, operator.delete_prefix('!'), value, Journal.table_name, 'notes'})" + " AND (#{Journal.visible_notes_condition(User.current, :skip_pre_condition => true)})" "#{/^!/.match?(operator) ? "NOT EXISTS" : "EXISTS"} (#{subquery})" end diff --git a/app/models/query.rb b/app/models/query.rb index b9a7181fa..1826bd509 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -211,7 +211,7 @@ class QueryFilter def initialize(field, options) @field = field.to_s @options = options - @options[:name] ||= l(options[:label] || "field_#{field}".gsub(/_id$/, '')) + @options[:name] ||= l(options[:label] || "field_#{field}".delete_suffix('_id')) # Consider filters with a Proc for values as remote by default @remote = options.key?(:remote) ? options[:remote] : options[:values].is_a?(Proc) end |