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);
|
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) {
|
appending(postIds) {
|
||||||
this._changeArray(() => {
|
this._changeArray(() => {
|
||||||
const appendingIds = this._appendingIds;
|
const appendingIds = this._appendingIds;
|
||||||
|
|
|
@ -429,12 +429,15 @@ export default RestModel.extend({
|
||||||
removePosts(posts) {
|
removePosts(posts) {
|
||||||
if (Ember.isEmpty(posts)) { return; }
|
if (Ember.isEmpty(posts)) { return; }
|
||||||
|
|
||||||
|
this.get('postsWithPlaceholders').refreshAll(() => {
|
||||||
|
const allPosts = this.get('posts');
|
||||||
const postIds = posts.map(p => p.get('id'));
|
const postIds = posts.map(p => p.get('id'));
|
||||||
const identityMap = this._identityMap;
|
const identityMap = this._identityMap;
|
||||||
|
|
||||||
this.get('stream').removeObjects(postIds);
|
this.get('stream').removeObjects(postIds);
|
||||||
this.get('posts').removeObjects(posts);
|
allPosts.removeObjects(posts);
|
||||||
postIds.forEach(id => delete identityMap[id]);
|
postIds.forEach(id => delete identityMap[id]);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns a post from the identity map if it's been inserted.
|
// Returns a post from the identity map if it's been inserted.
|
||||||
|
|
Loading…
Reference in New Issue