FIX: Placeholders should not show up to non-admins when deleting posts
This commit is contained in:
parent
4e209846cb
commit
aa31f3081a
|
@ -36,6 +36,11 @@ export default Ember.Object.extend(Ember.Array, {
|
|||
this._changeArray(cb, this.get('posts.length') - 1, 1, 0);
|
||||
},
|
||||
|
||||
refreshAll(cb) {
|
||||
const length = this.get('posts.length');
|
||||
this._changeArray(cb, 0, length, length);
|
||||
},
|
||||
|
||||
appending(postIds) {
|
||||
this._changeArray(() => {
|
||||
const appendingIds = this._appendingIds;
|
||||
|
|
|
@ -429,12 +429,15 @@ export default RestModel.extend({
|
|||
removePosts(posts) {
|
||||
if (Ember.isEmpty(posts)) { return; }
|
||||
|
||||
const postIds = posts.map(p => p.get('id'));
|
||||
const identityMap = this._identityMap;
|
||||
this.get('postsWithPlaceholders').refreshAll(() => {
|
||||
const allPosts = this.get('posts');
|
||||
const postIds = posts.map(p => p.get('id'));
|
||||
const identityMap = this._identityMap;
|
||||
|
||||
this.get('stream').removeObjects(postIds);
|
||||
this.get('posts').removeObjects(posts);
|
||||
postIds.forEach(id => delete identityMap[id]);
|
||||
this.get('stream').removeObjects(postIds);
|
||||
allPosts.removeObjects(posts);
|
||||
postIds.forEach(id => delete identityMap[id]);
|
||||
});
|
||||
},
|
||||
|
||||
// Returns a post from the identity map if it's been inserted.
|
||||
|
|
Loading…
Reference in New Issue