[refs #114] only new comment notification
This commit is contained in:
parent
36a895385c
commit
ab081d3c46
|
@ -18,12 +18,6 @@ class UserMailer < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
|
||||
def new_comment_reply_notification(comment, user)
|
||||
@user = user
|
||||
@comment = comment
|
||||
template = 'new_commit_comment_reply_notification' if @comment.commentable_type == 'Grit::Commit'
|
||||
mail(:to => user.email, :subject => I18n.t("notifications.subjects.new_comment_reply_notification"), :template_name => template) end
|
||||
|
||||
def new_issue_notification(issue, user)
|
||||
@user = user
|
||||
@issue = issue
|
||||
|
|
|
@ -8,13 +8,13 @@ class Subscribe < ActiveRecord::Base
|
|||
if commentable_class == Grit::Commit
|
||||
subscribes = comment.project.commit_comments_subscribes(true) # FIXME (true) for rspec
|
||||
committer = User.where(:email => comment.commentable.committer.email).first
|
||||
Subscribe.send_notification(comment, committer) if committer && committer.notifier.new_comment_commit_owner && subscribes.where(:user_id => committer).empty?
|
||||
UserMailer.delay.new_comment_notification(comment, user) if committer && committer.notifier.new_comment_commit_owner && subscribes.where(:user_id => committer).empty?
|
||||
end
|
||||
subscribes.each do |subscribe|
|
||||
user = subscribe.user
|
||||
next if comment.own_comment?(user) || !user.notifier.can_notify
|
||||
Subscribe.send_notification(comment, user) if commentable_class == Issue && user.notifier.new_comment_reply
|
||||
Subscribe.send_notification(comment, user) if commentable_class == Grit::Commit && Subscribe.send_notification_for_commit_comment?(subscribe.subscribeable, user, comment)
|
||||
UserMailer.delay.new_comment_notification(comment, user) if commentable_class == Issue && user.notifier.new_comment_reply
|
||||
UserMailer.delay.new_comment_notification(comment, user) if commentable_class == Grit::Commit && Subscribe.send_notification_for_commit_comment?(subscribe.subscribeable, user, comment)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -23,14 +23,6 @@ class Subscribe < ActiveRecord::Base
|
|||
list.create(:user_id => user_id) unless list.exists?(:user_id => user_id)
|
||||
end
|
||||
|
||||
def self.send_notification(comment, user)
|
||||
if Comment.where(:commentable_type => comment.commentable_type, :commentable_id => comment.commentable.id.to_s, :user_id => user.id).exists?
|
||||
UserMailer.delay.new_comment_reply_notification(comment, user)
|
||||
else
|
||||
UserMailer.delay.new_comment_notification(comment, user)
|
||||
end
|
||||
end
|
||||
|
||||
def self.send_notification_for_commit_comment?(project, user, comment)
|
||||
is_owner = (project.owner_id == user.id)
|
||||
is_commentor = (project.commit_comments_subscribes.exists?(:user_id => user.id))
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
%p== Здравствуйте, #{@user.name}.
|
||||
|
||||
|
||||
%p На Ваш комментарий в задаче #{ link_to @comment.commentable.title, [@comment.commentable.project, @comment.commentable] } был дан ответ.
|
||||
|
||||
%p "#{ @comment.body }"
|
||||
|
||||
|
||||
%p== Команда поддержки «ROSA Build System»
|
Loading…
Reference in New Issue