update reshare count when resharing; return PostPresenter for reshare root in the success response
This commit is contained in:
parent
899136d0e5
commit
3ec7755c83
2 changed files with 8 additions and 3 deletions
|
|
@ -9,6 +9,6 @@ class ResharesController < ApplicationController
|
|||
current_user.dispatch_post(@reshare, :url => post_url(@reshare), :additional_subscribers => @reshare.root.author)
|
||||
end
|
||||
|
||||
render :json => @reshare.as_api_response(:backbone), :status => 201
|
||||
render :json => PostPresenter.new(@reshare.root, current_user).to_json, :status => 201
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -34,10 +34,15 @@ app.views.Feedback = app.views.Base.extend({
|
|||
if(evt) { evt.preventDefault(); }
|
||||
if(!window.confirm("Reshare " + this.model.reshareAuthor().name + "'s post?")) { return }
|
||||
var reshare = this.model.reshare()
|
||||
var model = this.model
|
||||
|
||||
reshare.save({}, {
|
||||
url: this.model.createReshareUrl,
|
||||
success : function(){
|
||||
app.stream.add(reshare);
|
||||
success : function(resp){
|
||||
app.stream && app.stream.add(reshare);
|
||||
|
||||
model.set(resp.get("post"))
|
||||
model.trigger("feedback")
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue