Fixes conflicts

This commit is contained in:
Alberto Garcia Cabeza
2015-08-08 13:28:29 +02:00
38 changed files with 562 additions and 83 deletions

View File

@@ -20,7 +20,7 @@ class AccountController < ApplicationController
end
def account_params
params.require(:account).permit(:first_name, :last_name, :nickname, :use_nickname)
params.require(:account).permit(:first_name, :last_name, :nickname, :use_nickname, :email_on_debate_comment, :email_on_comment_reply)
end
end

View File

@@ -7,6 +7,10 @@ class CommentsController < ApplicationController
@comment = Comment.build(@debate, current_user, params[:comment][:body])
@comment.save!
@comment.move_to_child_of(@parent) if reply?
Mailer.comment(@comment).deliver_now if email_on_debate_comment?
Mailer.reply(@comment).deliver_now if email_on_comment_reply?
respond_with @comment
end
@@ -32,4 +36,12 @@ class CommentsController < ApplicationController
def reply?
@parent.class == Comment
end
def email_on_debate_comment?
@comment.debate.author.email_on_debate_comment?
end
def email_on_comment_reply?
reply? && @parent.author.email_on_comment_reply?
end
end