Skip to content

Commit

Permalink
Added group members to assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
koledas authored Jun 12, 2020
1 parent 52d00d9 commit d2fbc65
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/custom_users_as_assignees/issue_query_patch.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module CustomUsersAsAssignees
module CustomUsersAsAssignees
module IssueQueryPatch
def self.included(base)
def self.included(base)
base.send :include, InstanceMethods
base.class_eval do
alias_method :initialize_available_filters_without_extra_filters, :initialize_available_filters
Expand All @@ -12,11 +12,11 @@ module InstanceMethods
def initialize_available_filters_with_extra_filters
return @initialize_available_filters if @initialize_available_filters
initialize_available_filters_without_extra_filters

add_available_filter("just_assigned_to_id",
:type => :list_optional, :values => lambda { assigned_to_values }
)

@initialize_available_filters

end
Expand All @@ -28,6 +28,7 @@ def sql_for_just_assigned_to_id_field(field, operator, value)
if value.delete("me")
if User.current.logged?
value.push(User.current.id.to_s)
value += User.current.group_ids.map(&:to_s)
else
value.push("0")
end
Expand All @@ -40,7 +41,7 @@ def sql_for_just_assigned_to_id_field(field, operator, value)
def sql_for_assigned_to_id_field(field, operator, value)
targets = value;
value.each do |target|
begin
begin
targets += User.find(target).group_ids.map(&:to_s)
targets.uniq!
rescue
Expand Down

0 comments on commit d2fbc65

Please sign in to comment.