app/controllers/commontator/comments_controller.rb in commontator-4.8.0 vs app/controllers/commontator/comments_controller.rb in commontator-4.9.0

- old
+ new

@@ -1,16 +1,15 @@ module Commontator class CommentsController < Commontator::ApplicationController - before_filter :get_thread, :only => [:new, :create] - before_filter :get_comment_and_thread, :except => [:new, :create] + before_filter :set_thread, :only => [:new, :create] + before_filter :set_comment_and_thread, :except => [:new, :create] # GET /threads/1/comments/new def new @comment = Comment.new @comment.thread = @thread @comment.creator = @user - security_transgression_unless @comment.can_be_created_by?(@user) @per_page = params[:per_page] || @thread.config.comments_per_page respond_to do |format| @@ -21,14 +20,13 @@ end # POST /threads/1/comments def create @comment = Comment.new - @comment.body = params[:comment].nil? ? nil : params[:comment][:body] @comment.thread = @thread @comment.creator = @user - + @comment.body = params[:comment].nil? ? nil : params[:comment][:body] security_transgression_unless @comment.can_be_created_by?(@user) respond_to do |format| if !params[:cancel].nil? format.html { redirect_to @thread } @@ -142,12 +140,12 @@ end end protected - def get_comment_and_thread + def set_comment_and_thread @comment = Comment.find(params[:id]) @thread = @comment.thread + commontator_set_new_comment(@thread, @user) end end end -