prevents users to receive email notifications about own comments and replies
This commit is contained in:
@@ -7,10 +7,7 @@ class CommentsController < ApplicationController
|
||||
respond_to :html, :js
|
||||
|
||||
def create
|
||||
if @comment.save
|
||||
Mailer.comment(@comment).deliver_later if email_on_debate_comment?
|
||||
Mailer.reply(@comment).deliver_later if email_on_comment_reply?
|
||||
else
|
||||
unless @comment.save
|
||||
render :new
|
||||
end
|
||||
end
|
||||
@@ -55,14 +52,6 @@ class CommentsController < ApplicationController
|
||||
@commentable = Comment.find_commentable(comment_params[:commentable_type], comment_params[:commentable_id])
|
||||
end
|
||||
|
||||
def email_on_debate_comment?
|
||||
@comment.commentable.author.email_on_debate_comment?
|
||||
end
|
||||
|
||||
def email_on_comment_reply?
|
||||
@comment.reply? && @comment.parent.author.email_on_comment_reply?
|
||||
end
|
||||
|
||||
def administrator_comment?
|
||||
["1", true].include?(comment_params[:as_administrator]) && can?(:comment_as_administrator, Debate)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user