Closed ashrafalzyoud closed 1 year ago
Hi,
Use this code in AFTER_SAVE section:
unless self.parent.nil?
self.parent.watcher_user_ids.each do |w_user|
Watcher.create(:watchable_type=> 'Issue',:watchable_id=> self.id,:user_id=> w_user)
end
end
I hope it helps!
I will test it Thx for your reply And we miss u @AirTibu
thx @AirTibu its work for me im using this example #161 how i can added group only as watcher without every on of user?? @AirTibu
Hi,
If you would like to add only the groups, than add a condition inside the loop, like this:
unless self.parent.nil?
self.parent.watcher_user_ids.each do |w_user|
Watcher.create(:watchable_type=> 'Issue',:watchable_id=> self.id,:user_id=> w_user) unless Group.find(w_user).nil?
end
end
I hope it helps!
if self.assigned_to.is_a?(Group)
arr = Array.new
arr = Group.find(self.assigned_to_id).user_ids
for item in arr
self.add_watcher(User.find(item)) unless self.watched_by?(User.find(item))
end
end
how i can added Assignee group = group as wachers? this i want? @AirTibu im try this code
if self.assigned_to.is_a?(Group)
self.add_watcher(:watchable_type=> 'Issue',:watchable_id=> self.id,:user_id=> w_user) unless Group.find(w_user).nil?
end
Hi,
Use this code in AFTER_SAVE section:
self.add_watcher(self.assigned_to) unless self.assigned_to.nil? || Group.find(self.assigned_to.id).nil?
I hope it helps!
how i can inherited group watcher to subtask