#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,13 +42,6 @@ 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)
end
end
Comment.create_link_on_issues_from_item(self)
end
def send_new_comment_commit_notification(subscribe)
ActivityFeed.create( ActivityFeed.create(
:user => subscribe.user, :user => subscribe.user,
:kind => 'new_comment_commit_notification', :kind => 'new_comment_commit_notification',
@ -47,10 +55,12 @@ module Modules::Observers::ActivityFeed::Comment
:project_id => project.id, :project_id => project.id,
:comment_id => id, :comment_id => id,
:project_name => project.name, :project_name => project.name,
:project_owner => project.owner.uname :project_owner => project.owner.uname}
}
) )
end end
end
Comment.create_link_on_issues_from_item(self)
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