fixed js error on new comments on statusmessage show page

This commit is contained in:
Maxwell Salzberg 2011-05-06 15:29:33 -07:00
parent f1f0d6e2ea
commit 7a2f6dae10
3 changed files with 6 additions and 16 deletions

View file

@ -21,18 +21,7 @@ class CommentsController < ApplicationController
Postzord::Dispatch.new(current_user, @comment).post Postzord::Dispatch.new(current_user, @comment).post
respond_to do |format| respond_to do |format|
format.js{ format.js{ render(:create, :status => 201)}
json = { :post_id => @comment.post_id,
:comment_id => @comment.id,
:html => render_to_string(
:partial => 'comments/comment',
:locals => { :comment => @comment,
:person => current_user.person,
}
)
}
render(:json => json, :status => 201)
}
format.html{ render :nothing => true, :status => 201 } format.html{ render :nothing => true, :status => 201 }
format.mobile{ redirect_to @comment.post } format.mobile{ redirect_to @comment.post }
end end

View file

@ -0,0 +1,5 @@
WebSocketReceiver.processComment(<%= @comment.post_id %>,
<%= @comment.id %>,
"<%= escape_javascript(render(:partial => 'comments/comment', :locals => { :comment => @comment, :person => current_user.person}))%>",
false);

View file

@ -89,10 +89,6 @@ var Stream = {
} }
}); });
$(stream_string + " .new_comment").live('ajax:success', function(data, json, xhr) {
json = $.parseJSON(json);
WebSocketReceiver.processComment(json.post_id, json.comment_id, json.html, false);
});
$(stream_string + ".new_comment").live('ajax:failure', function(data, html, xhr) { $(stream_string + ".new_comment").live('ajax:failure', function(data, html, xhr) {
Diaspora.widgets.alert.alert('Failed to post message!'); Diaspora.widgets.alert.alert('Failed to post message!');
}); });