From 48bd3455737e218b4fc6f62808501ad00046e6cf Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 27 Jun 2013 20:18:53 +0400 Subject: [PATCH] #200: rollback some changes --- .../observers/activity_feed/comment.rb | 52 +++++++++++-------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/lib/modules/observers/activity_feed/comment.rb b/lib/modules/observers/activity_feed/comment.rb index 920169b4d..8a12429a5 100644 --- a/lib/modules/observers/activity_feed/comment.rb +++ b/lib/modules/observers/activity_feed/comment.rb @@ -15,7 +15,22 @@ module Modules::Observers::ActivityFeed::Comment commentable.subscribes.each do |subscribe| if user_id != subscribe.user_id 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 elsif commit_comment? @@ -27,31 +42,26 @@ module Modules::Observers::ActivityFeed::Comment (subscribe.user.committer?(self.commentable) && subscribe.user.notifier.new_comment_commit_owner) ) UserMailer.new_comment_notification(self, subscribe.user).deliver 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 Comment.create_link_on_issues_from_item(self) 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) User.find(subscribe.user).notifier.new_comment && User.find(subscribe.user).notifier.can_notify end