mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Make select all and below skip small actions. (#7425)
This commit is contained in:
@@ -173,11 +173,32 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||
},
|
||||
|
||||
_updateSelectedPostIds(postIds) {
|
||||
this.get("selectedPostIds").pushObjects(postIds);
|
||||
const smallActionsPostIds = this._smallActionPostIds();
|
||||
this.get("selectedPostIds").pushObjects(
|
||||
postIds.filter(postId => !smallActionsPostIds.has(postId))
|
||||
);
|
||||
this.set("selectedPostIds", [...new Set(this.get("selectedPostIds"))]);
|
||||
this._forceRefreshPostStream();
|
||||
},
|
||||
|
||||
_smallActionPostIds() {
|
||||
const smallActionsPostIds = new Set();
|
||||
const posts = this.get("model.postStream.posts");
|
||||
if (posts) {
|
||||
const small_action = this.site.get("post_types.small_action");
|
||||
const whisper = this.site.get("post_types.whisper");
|
||||
posts.forEach(post => {
|
||||
if (
|
||||
post.post_type === small_action ||
|
||||
(!post.cooked && post.post_type === whisper)
|
||||
) {
|
||||
smallActionsPostIds.add(post.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
return smallActionsPostIds;
|
||||
},
|
||||
|
||||
_loadPostIds(post) {
|
||||
if (this.get("loadingPostIds")) return;
|
||||
|
||||
@@ -664,7 +685,12 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||
},
|
||||
|
||||
selectAll() {
|
||||
this.set("selectedPostIds", [...this.get("model.postStream.stream")]);
|
||||
const smallActionsPostIds = this._smallActionPostIds();
|
||||
this.set("selectedPostIds", [
|
||||
...this.get("model.postStream.stream").filter(
|
||||
postId => !smallActionsPostIds.has(postId)
|
||||
)
|
||||
]);
|
||||
this._forceRefreshPostStream();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user