#200: rollback some changes

This commit is contained in:
Vokhmin Alexey V 2013-06-27 20:18:53 +04:00
parent 0bd7b042c4
commit 48bd345573
1 changed files with 31 additions and 21 deletions

View File

@ -15,7 +15,22 @@ module Modules::Observers::ActivityFeed::Comment
commentable.subscribes.each do |subscribe| commentable.subscribes.each do |subscribe|
if user_id != subscribe.user_id if user_id != subscribe.user_id
UserMailer.new_comment_notification(self, subscribe.user).deliver if can_notify_on_new_comment?(subscribe) UserMailer.new_comment_notification(self, subscribe.user).deliver if can_notify_on_new_comment?(subscribe)
send_new_comment_commit_notification(subscribe) ActivityFeed.create(
:user => subscribe.user,
:kind => 'new_comment_notification',
:data => {
:user_name => user.name,
:user_email => user.email,
:user_id => user_id,
:comment_body => body,
:issue_title => commentable.title,
:issue_serial_id => commentable.serial_id,
:project_id => commentable.project.id,
:comment_id => id,
:project_name => project.name,
:project_owner => project.owner.uname
}
)
end end
end end
elsif commit_comment? elsif commit_comment?
@ -27,31 +42,26 @@ module Modules::Observers::ActivityFeed::Comment
(subscribe.user.committer?(self.commentable) && subscribe.user.notifier.new_comment_commit_owner) ) (subscribe.user.committer?(self.commentable) && subscribe.user.notifier.new_comment_commit_owner) )
UserMailer.new_comment_notification(self, subscribe.user).deliver UserMailer.new_comment_notification(self, subscribe.user).deliver
end end
send_new_comment_commit_notification(subscribe) ActivityFeed.create(
:user => subscribe.user,
:kind => 'new_comment_commit_notification',
:data => {
:user_name => user.name,
:user_email => user.email,
:user_id => user_id,
:comment_body => body,
:commit_message => commentable.message,
:commit_id => commentable.id,
:project_id => project.id,
:comment_id => id,
:project_name => project.name,
:project_owner => project.owner.uname}
)
end end
end end
Comment.create_link_on_issues_from_item(self) Comment.create_link_on_issues_from_item(self)
end end
def send_new_comment_commit_notification(subscribe)
ActivityFeed.create(
:user => subscribe.user,
:kind => 'new_comment_commit_notification',
:data => {
:user_name => user.name,
:user_email => user.email,
:user_id => user_id,
:comment_body => body,
:commit_message => commentable.message,
:commit_id => commentable.id,
:project_id => project.id,
:comment_id => id,
:project_name => project.name,
:project_owner => project.owner.uname
}
)
end
def can_notify_on_new_comment?(subscribe) def can_notify_on_new_comment?(subscribe)
User.find(subscribe.user).notifier.new_comment && User.find(subscribe.user).notifier.can_notify User.find(subscribe.user).notifier.new_comment && User.find(subscribe.user).notifier.can_notify
end end