Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ For Redmine versions prior to 2.x, check out the pre-2.x branch.

A user is involved in the issue if he/she either is the author of the
issue, or is assigned to the issue or has updated the issue at least
once.
once or is watching the issue.

Adds "My involvement" filter for issue queries with a bool option:
either "is involved" or "is not involved".
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end

prepare_block = Proc.new do
Query.send(:include, RedmineInvolvementFilter::QueryPatch)
IssueQuery.send(:include, RedmineInvolvementFilter::IssueQueryPatch)
end

if Rails.env.development?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module RedmineInvolvementFilter
module QueryPatch
module IssueQueryPatch
unloadable

def self.included(base)
Expand Down Expand Up @@ -34,15 +34,23 @@ def sql_for_involved_user_id_field(field, operator, value)
cond = 'AND'
end

issue_ids_sql = %(
journalized_issue_ids_sql = %(
SELECT DISTINCT journalized_id
FROM #{Journal.table_name}
WHERE journalized_type='Issue'
AND user_id IN #{user_ids}
)
watched_issue_ids_sql = %(
SELECT DISTINCT watchable_id
FROM #{Watcher.table_name}
WHERE watchable_type='Issue'
AND user_id IN #{user_ids}
)

sql = ["#{Issue.table_name}.assigned_to_id #{inop} #{user_ids}",
"#{Issue.table_name}.author_id #{inop} #{user_ids}",
"#{Issue.table_name}.id #{inop} (#{issue_ids_sql})"].join(" #{cond} ")
"#{Issue.table_name}.id #{inop} (#{journalized_issue_ids_sql})",
"#{Issue.table_name}.id #{inop} (#{watched_issue_ids_sql})"].join(" #{cond} ")

"(#{sql})"
end
Expand Down