From: Go MAEDA Date: Sun, 16 Apr 2023 08:02:30 +0000 (+0000) Subject: Change the notation of "contains any of" filter operator to "*~" (#38435). X-Git-Tag: 5.1.0~166 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f6507a607c10fbc971f4bb148594cb0de5c2e71;p=redmine.git Change the notation of "contains any of" filter operator to "*~" (#38435). git-svn-id: https://svn.redmine.org/redmine/trunk@22197 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index 2aa60fcea..5c66800f9 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -614,8 +614,8 @@ class IssueQuery < Query when "*", "!*" e = (operator == "*" ? "EXISTS" : "NOT EXISTS") "#{e} (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id)" - when "~", "!~", "|~" - c = sql_contains("a.filename", value.first, :all_words => (operator != "|~")) + when "~", "!~", "*~" + c = sql_contains("a.filename", value.first, :all_words => (operator != "*~")) e = (operator == "!~" ? "NOT EXISTS" : "EXISTS") "#{e} (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id AND (#{c}))" when "^", "$" @@ -630,9 +630,9 @@ class IssueQuery < Query case operator when '*', '!*' (operator == '*' ? cond_description : "NOT (#{cond_description})") - when '~', '!~', '|~' + when '~', '!~', '*~' (operator == '~' ? '' : "#{cond_description} AND ") + - sql_contains('a.description', value.first, :match => (operator != '!~'), :all_words => (operator != '|~')) + sql_contains('a.description', value.first, :match => (operator != '!~'), :all_words => (operator != '*~')) when '^', '$' sql_contains('a.description', value.first, (operator == '^' ? :starts_with : :ends_with) => true) else @@ -794,7 +794,7 @@ class IssueQuery < Query is_all_words = case operator when '~' then true - when '|~', '!~' then false + when '*~', '!~' then false end fetcher = Redmine::Search::Fetcher.new( diff --git a/app/models/query.rb b/app/models/query.rb index 10bd23adf..7764fede1 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -306,7 +306,7 @@ class Query < ActiveRecord::Base "t-" => :label_ago, "~" => :label_contains, "!~" => :label_not_contains, - "|~" => :label_contains_any_of, + "*~" => :label_contains_any_of, "^" => :label_starts_with, "$" => :label_ends_with, "=p" => :label_any_issues_in_project, @@ -324,9 +324,9 @@ class Query < ActiveRecord::Base :list_subprojects => [ "*", "!*", "=", "!" ], :date => [ "=", ">=", "<=", "><", "t+", ">t-", " [ "=", ">=", "<=", "><", ">t-", " [ "~", "|~", "=", "!~", "!", "^", "$", "!*", "*" ], - :text => [ "~", "|~", "!~", "^", "$", "!*", "*" ], - :search => [ "~", "|~", "!~" ], + :string => [ "~", "*~", "=", "!~", "!", "^", "$", "!*", "*" ], + :text => [ "~", "*~", "!~", "^", "$", "!*", "*" ], + :search => [ "~", "*~", "!~" ], :integer => [ "=", ">=", "<=", "><", "!*", "*" ], :float => [ "=", ">=", "<=", "><", "!*", "*" ], :relation => ["=", "!", "=p", "=!p", "!p", "*o", "!o", "!*", "*"], @@ -1432,7 +1432,7 @@ class Query < ActiveRecord::Base sql = sql_contains("#{db_table}.#{db_field}", value.first) when "!~" sql = sql_contains("#{db_table}.#{db_field}", value.first, :match => false) - when "|~" + when "*~" sql = sql_contains("#{db_table}.#{db_field}", value.first, :all_words => false) when "^" sql = sql_contains("#{db_table}.#{db_field}", value.first, :starts_with => true) diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 406fca08d..e93d16551 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -348,7 +348,7 @@ class RedCloth3 < String S = "(?:#{S_CSPN}?#{S_RSPN}|#{S_RSPN}?#{S_CSPN}?)" C = "(?:#{C_CLAS}?#{C_STYL}?#{C_LNGE}?|#{C_STYL}?#{C_LNGE}?#{C_CLAS}?|#{C_LNGE}?#{C_STYL}?#{C_CLAS}?)" # PUNCT = Regexp::quote( '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' ) - PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' ) + PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`*~' ) PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' ) PUNCT_Q = Regexp::quote( '*-_+^~%' ) HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)' diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 2f09952e5..164a7d304 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -742,7 +742,7 @@ class QueryTest < ActiveSupport::TestCase :name => '_', :filters => { 'subject' => { - :operator => '|~', + :operator => '*~', :values => ['close block'] } } @@ -758,7 +758,7 @@ class QueryTest < ActiveSupport::TestCase :name => '_', :filters => { 'any_searchable' => { - :operator => '|~', + :operator => '*~', :values => ['recipe categories'] } } @@ -773,7 +773,7 @@ class QueryTest < ActiveSupport::TestCase :name => '_', :filters => { 'attachment' => { - :operator => '|~', + :operator => '*~', :values => ['source changeset'] } } @@ -788,7 +788,7 @@ class QueryTest < ActiveSupport::TestCase :name => '_', :filters => { 'attachment_description' => { - :operator => '|~', + :operator => '*~', :values => ['ruby issue'] } }