defer comments posting in comment controller
This commit is contained in:
parent
1d19dba9b4
commit
5914ed4ef1
1 changed files with 3 additions and 4 deletions
|
|
@ -15,7 +15,7 @@ class CommentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
target = current_user.find_visible_shareable_by_id Post, params[:post_id]
|
target = current_user.find_visible_shareable_by_id(Post, params[:post_id])
|
||||||
text = params[:text]
|
text = params[:text]
|
||||||
|
|
||||||
if target
|
if target
|
||||||
|
|
@ -24,7 +24,7 @@ class CommentsController < ApplicationController
|
||||||
if @comment.save
|
if @comment.save
|
||||||
Rails.logger.info("event => :create, :type => :comment, :user => #{current_user.diaspora_handle},
|
Rails.logger.info("event => :create, :type => :comment, :user => #{current_user.diaspora_handle},
|
||||||
:status => :success, :comment => #{@comment.id}, :chars => #{params[:text].length}")
|
:status => :success, :comment => #{@comment.id}, :chars => #{params[:text].length}")
|
||||||
Postzord::Dispatcher.build(current_user, @comment).post
|
current_user.dispatch_post(@comment)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json{ render :json => @comment.as_api_response(:backbone), :status => 201 }
|
format.json{ render :json => @comment.as_api_response(:backbone), :status => 201 }
|
||||||
|
|
@ -51,8 +51,7 @@ class CommentsController < ApplicationController
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.mobile {redirect_to :back}
|
format.mobile {redirect_to :back}
|
||||||
format.js {render :nothing => true, :status => 403}
|
format.any(:js, :json) {render :nothing => true, :status => 403}
|
||||||
format.json { render :nothing => true, :status => 403 }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue