Merge branch '2875-ignore-user-posts' of https://github.com/hpetru/diaspora into hpetru-2875-ignore-user-posts

Conflicts:
	Changelog.md
This commit is contained in:
Florian Staudacher 2014-08-13 14:30:28 +02:00
commit 163b76ae3d
4 changed files with 30 additions and 13 deletions

View file

@ -19,6 +19,7 @@
* Set mention notification as read when viewing post [#5006](https://github.com/diaspora/diaspora/pull/5006)
* Set sharing notification as read when viewing profile [#5009](https://github.com/diaspora/diaspora/pull/5009)
* Ensure a consistent border on text input elements [#5069](https://github.com/diaspora/diaspora/pull/5069)
* Fix which allow to remove ignored users posts without page refresh [#2875](https://github.com/diaspora/diaspora/issues/2875)
## Features
* Port admin pages to bootstrap, polish user search results, allow accounts to be closed from the backend [#5046](https://github.com/diaspora/diaspora/pull/5046)

View file

@ -19,6 +19,7 @@ var app = {
views: {},
pages: {},
forms: {},
vent: _.extend({}, Backbone.Events),
user: function(userAttrs) {
if(userAttrs) { return this._user = new app.models.User(userAttrs) }

View file

@ -27,6 +27,9 @@ app.views.StreamPost = app.views.Post.extend({
tooltipSelector : ".timeago, .post_scope, .block_user, .delete",
initialize : function(){
var personId = this.model.get('author').id;
app.vent.on('remove:author:posts:'+personId, this.remove, this);
this.model.on('remove', this.remove, this);
//subviews
this.commentStreamView = new app.views.CommentStream({model : this.model});
@ -77,13 +80,7 @@ app.views.StreamPost = app.views.Post.extend({
block.save({block : {person_id : personId}}, {
success : function(){
if(!app.stream) { return }
_.each(app.stream.posts.models, function(model){
if(model.get("author").id == personId) {
app.stream.posts.remove(model);
}
})
app.vent.trigger('remove:author:posts:'+personId);
}
})
},

View file

@ -1,8 +1,32 @@
describe("app.views.StreamPost", function(){
beforeEach(function(){
this.PostViewClass = app.views.StreamPost
var posts = $.parseJSON(spec.readFixture("stream_json"));
this.collection = new app.collections.Posts(posts);
this.statusMessage = this.collection.models[0];
this.reshare = this.collection.models[1];
})
describe("events", function(){
var _PostViewClass = undefined;
var author_id = undefined;
beforeEach(function(){
_PostViewClass = this.PostViewClass;
authorId = this.statusMessage.get('author').id;
});
describe("remove posts for blocked person", function(){
it("setup remove:author:posts:#{id} to #remove", function(){
spyOn(_PostViewClass.prototype, 'remove');
view = new _PostViewClass({model : this.statusMessage});
app.vent.trigger('remove:author:posts:'+authorId);
expect(_PostViewClass.prototype.remove).toHaveBeenCalled();
});
});
});
describe("#render", function(){
var o_embed_cache = {
"data" : {
@ -32,12 +56,6 @@ describe("app.views.StreamPost", function(){
other : "<%= count %> Likes"
}
}})
var posts = $.parseJSON(spec.readFixture("stream_json"));
this.collection = new app.collections.Posts(posts);
this.statusMessage = this.collection.models[0];
this.reshare = this.collection.models[1];
})
context("reshare", function(){