diff --git a/app/assets/javascripts/app/views/post_controls_view.js b/app/assets/javascripts/app/views/post_controls_view.js index 78c0ee3df..879d4d623 100644 --- a/app/assets/javascripts/app/views/post_controls_view.js +++ b/app/assets/javascripts/app/views/post_controls_view.js @@ -76,6 +76,10 @@ app.views.PostControls = app.views.Base.extend({ $.post(Routes.postParticipation(this.model.get("id")), {_method: "delete"}, function() { this.model.set({participation: false}); }.bind(this)); + }, + + destroyModel: function() { + this.post.destroyModel(); } }); // @license-end diff --git a/app/assets/javascripts/app/views/stream_post_views.js b/app/assets/javascripts/app/views/stream_post_views.js index ee0968420..c723d514b 100644 --- a/app/assets/javascripts/app/views/stream_post_views.js +++ b/app/assets/javascripts/app/views/stream_post_views.js @@ -33,7 +33,6 @@ app.views.StreamPost = app.views.Post.extend({ var personId = this.model.get("author").id; app.events.on("person:block:" + personId, this.remove, this); } - this.model.on("remove", this.remove, this); //subviews this.commentStreamView = new app.views.CommentStream({model : this.model}); this.oEmbedView = new app.views.OEmbed({model : this.model}); diff --git a/app/assets/stylesheets/stream_element.scss b/app/assets/stylesheets/stream_element.scss index 0cf1c6067..2ef09f3e0 100644 --- a/app/assets/stylesheets/stream_element.scss +++ b/app/assets/stylesheets/stream_element.scss @@ -4,7 +4,8 @@ margin: 0px; } &.deleting { - > .media { opacity: 0.3; } + opacity: .3; + .control-icons { display: none !important; } } } diff --git a/spec/javascripts/app/views/post_controls_view_spec.js b/spec/javascripts/app/views/post_controls_view_spec.js index e85cf571f..291d19b18 100644 --- a/spec/javascripts/app/views/post_controls_view_spec.js +++ b/spec/javascripts/app/views/post_controls_view_spec.js @@ -74,12 +74,15 @@ describe("app.views.PostControls", function() { }); it("calls destroyModel when removing a post", function() { - spyOn(app.views.PostControls.prototype, "destroyModel"); + spyOn(app.views.PostControls.prototype, "destroyModel").and.callThrough(); + spyOn(app.views.Post.prototype, "destroyModel"); app.currentUser = new app.models.User(this.model.attributes.author); - this.view = new app.views.PostControls({model: this.model}); + this.postView = new app.views.Post({model: this.model}); + this.view = new app.views.PostControls({model: this.model, post: this.postView}); this.view.render(); this.view.$(".remove_post.delete").click(); expect(app.views.PostControls.prototype.destroyModel).toHaveBeenCalled(); + expect(app.views.Post.prototype.destroyModel).toHaveBeenCalled(); }); it("calls hidePost when hiding a post", function() {