Merge pull request #208 from abf/rosa-build:200-update-issue-observer
#200: Send only one message on create
This commit is contained in:
commit
52badb20be
|
@ -4,7 +4,8 @@ module Modules::Observers::ActivityFeed::Issue
|
||||||
|
|
||||||
included do
|
included do
|
||||||
after_commit :new_issue_notifications, :on => :create
|
after_commit :new_issue_notifications, :on => :create
|
||||||
after_update -> { send_assign_notifications(:update) }
|
after_commit :send_assign_notifications, :on => :create
|
||||||
|
after_commit -> { send_assign_notifications(:update) }, :on => :update
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -12,7 +13,9 @@ module Modules::Observers::ActivityFeed::Issue
|
||||||
def new_issue_notifications
|
def new_issue_notifications
|
||||||
collect_recipients.each do |recipient|
|
collect_recipients.each do |recipient|
|
||||||
next if user_id == recipient.id
|
next if user_id == recipient.id
|
||||||
UserMailer.new_issue_notification(self, recipient).deliver if recipient.notifier.can_notify && recipient.notifier.new_issue
|
if recipient.notifier.can_notify && recipient.notifier.new_issue && assignee_id != recipient.id
|
||||||
|
UserMailer.new_issue_notification(self, recipient).deliver
|
||||||
|
end
|
||||||
ActivityFeed.create(
|
ActivityFeed.create(
|
||||||
:user => recipient,
|
:user => recipient,
|
||||||
:kind => 'new_issue_notification',
|
:kind => 'new_issue_notification',
|
||||||
|
@ -28,7 +31,6 @@ module Modules::Observers::ActivityFeed::Issue
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
send_assign_notifications
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_assign_notifications(action = :create)
|
def send_assign_notifications(action = :create)
|
||||||
|
|
Loading…
Reference in New Issue