diff --git a/Changelog.md b/Changelog.md index be126faecce6d4c873e3aab661786c0ceae766e8..9a4a39e269d5685f835ca3528cae5ae5dd657ddb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -89,6 +89,7 @@ With the port to Bootstrap 3, app/views/terms/default.haml has a new structure. * Implement NodeInfo [#6239](https://github.com/diaspora/diaspora/pull/6239) * Display original author on reshares of NSFW posts [#6270](https://github.com/diaspora/diaspora/pull/6270) * Use avatars in hovercards as links to the profile [#6297](https://github.com/diaspora/diaspora/pull/6297) +* Remove avatars of ignored users from stream faces [#6320](https://github.com/diaspora/diaspora/pull/6320) # 0.5.2.0 diff --git a/app/assets/javascripts/app/models/stream.js b/app/assets/javascripts/app/models/stream.js index 8201e997d3a11db9b1926a4525e5ea3bf7ccb951..f1978eb765302e1359acdceec72c3c6d18390472 100644 --- a/app/assets/javascripts/app/models/stream.js +++ b/app/assets/javascripts/app/models/stream.js @@ -83,6 +83,10 @@ app.models.Stream = Backbone.Collection.extend({ this.trigger("fetched"); }, + remove : function(models) { + this.items.remove(models); + }, + preloadOrFetch : function(){ //hai, plz test me THNX return $.when(app.hasPreload("stream") ? this.preload() : this.fetch()); }, diff --git a/app/assets/javascripts/app/views/stream_faces_view.js b/app/assets/javascripts/app/views/stream_faces_view.js index 0586f6df57e596be3b16e90f178018513dd60825..6ad00d057de1f24dfa82e9cc6c2e6a302296597f 100644 --- a/app/assets/javascripts/app/views/stream_faces_view.js +++ b/app/assets/javascripts/app/views/stream_faces_view.js @@ -11,6 +11,7 @@ app.views.StreamFaces = app.views.Base.extend({ initialize : function(){ this.updatePeople(); app.stream.items.bind("add", this.updatePeople, this); + app.stream.items.bind("remove", this.updatePeople, this); }, presenter : function() { diff --git a/app/assets/javascripts/app/views/stream_post_views.js b/app/assets/javascripts/app/views/stream_post_views.js index 60a965136901d4a690935d5be84e40718403ec4e..cd4012050bfd25b8e7ff37c17c05f58f562c9080 100644 --- a/app/assets/javascripts/app/views/stream_post_views.js +++ b/app/assets/javascripts/app/views/stream_post_views.js @@ -91,6 +91,7 @@ app.views.StreamPost = app.views.Post.extend({ remove : function() { $(this.el).slideUp(400, _.bind(function(){this.$el.remove()}, this)); + app.stream.remove(this.model); return this; }, diff --git a/spec/javascripts/app/views/stream_faces_view_spec.js b/spec/javascripts/app/views/stream_faces_view_spec.js index 98d24897a188079ef294c4572ed7a067cbed8250..af42b3c6d7f77de7cc219ad39e89eff5504d7d91 100644 --- a/spec/javascripts/app/views/stream_faces_view_spec.js +++ b/spec/javascripts/app/views/stream_faces_view_spec.js @@ -21,11 +21,15 @@ describe("app.views.StreamFaces", function(){ expect(this.view.people.length).toBe(5); }); - it("findsPeople when the collection changes", function(){ + it("Finds people that were added to the collection", function() { this.posts.add(factory.post({author : factory.author({name : "Harriet Tubman"})})); expect(this.view.people.length).toBe(6); }); + it("Finds people that were removed from the collection", function() { + this.posts.remove([this.post2, this.post3]); + expect(this.view.people.length).toBe(3); + }); describe(".render", function(){ beforeEach(function(){