summaryrefslogtreecommitdiffstats
path: root/app/models/issue_query.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-09-30 13:15:45 +0000
committerGo MAEDA <maeda@farend.jp>2019-09-30 13:15:45 +0000
commitb0f1175e3eeacbc66cf797c82e9ea7465e6bbf8d (patch)
tree34203316b408c1374b090ae766c2e7f27aa2add1 /app/models/issue_query.rb
parentc4df67dcaf19b93a7fcff7e0fd292f0a5e44e42f (diff)
downloadredmine-b0f1175e3eeacbc66cf797c82e9ea7465e6bbf8d.tar.gz
redmine-b0f1175e3eeacbc66cf797c82e9ea7465e6bbf8d.zip
Add support for "start with" and "end with" operators to "Files" filter (#31879).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@18570 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_query.rb')
-rw-r--r--app/models/issue_query.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index 7701cbfe2..155462c64 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -526,6 +526,9 @@ class IssueQuery < Query
c = sql_contains("a.filename", value.first)
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 AND #{c})"
+ when "^", "$"
+ c = sql_contains("a.filename", value.first, (operator == "^" ? :starts_with : :ends_with) => true)
+ "EXISTS (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id AND #{c})"
end
end