mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-28 23:14:04 -04:00
FIX: Placeholders should not show up to non-admins when deleting posts
This commit is contained in:
parent
4e209846cb
commit
aa31f3081a
2 changed files with 13 additions and 5 deletions
app/assets/javascripts/discourse
|
@ -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; }
|
||||||
|
|
||||||
const postIds = posts.map(p => p.get('id'));
|
this.get('postsWithPlaceholders').refreshAll(() => {
|
||||||
const identityMap = this._identityMap;
|
const allPosts = this.get('posts');
|
||||||
|
const postIds = posts.map(p => p.get('id'));
|
||||||
|
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…
Add table
Add a link
Reference in a new issue