diff --git a/public/javascripts/app/views/feedback_view.js b/public/javascripts/app/views/feedback_view.js index 6aecaa03a..489deb023 100644 --- a/public/javascripts/app/views/feedback_view.js +++ b/public/javascripts/app/views/feedback_view.js @@ -32,9 +32,11 @@ app.views.Feedback = app.views.StreamObject.extend({ if(window.confirm("Reshare " + this.model.baseAuthor().name + "'s post?")) { var reshare = new app.models.Reshare(); reshare.save({root_guid : this.model.baseGuid()}, { - success : $.proxy(function(data){ - app.stream.collection.add(this); - }, reshare) + success : function(data){ + var newPost = new app.models.Post(data); + app.stream.collection.add(newPost, {silent : true}); + app.stream.prependPost(newPost); + } }); return reshare; } diff --git a/public/javascripts/app/views/publisher_view.js b/public/javascripts/app/views/publisher_view.js index e4943f5d0..436752b04 100644 --- a/public/javascripts/app/views/publisher_view.js +++ b/public/javascripts/app/views/publisher_view.js @@ -27,9 +27,11 @@ app.views.Publisher = Backbone.View.extend({ "aspect_ids" : serializedForm["aspect_ids[]"], "photos" : serializedForm["photos[]"] }, { - success : $.proxy(function(data) { - app.stream.collection.add(this); - }, statusMessage) + success : function(data) { + var newPost = new app.models.Post(data); + app.stream.collection.add(newPost, {silent : true}); + app.stream.prependPost(newPost); + } }); // clear state diff --git a/public/javascripts/app/views/stream_view.js b/public/javascripts/app/views/stream_view.js index b0eadb184..af54a3da9 100644 --- a/public/javascripts/app/views/stream_view.js +++ b/public/javascripts/app/views/stream_view.js @@ -12,9 +12,18 @@ app.views.Stream = Backbone.View.extend({ return this; }, + prependPost : function(post) { + var postView = new app.views.Post({ model: post }); + $(this.el).prepend(postView.render().el); + + return this; + }, + appendPost: function(post) { var postView = new app.views.Post({ model: post }); $(this.el).append(postView.render().el); + + return this; }, collectionFetched: function() {