mirror of
https://github.com/discourse/discourse.git
synced 2025-05-02 03:24:35 +08:00
FIX: Selecting & moving posts not working on megatopics.
This commit is contained in:
parent
18e281606a
commit
409a30ce1c
@ -989,12 +989,30 @@ export default Ember.Controller.extend(BufferedContent, {
|
|||||||
: undefined;
|
: undefined;
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("selectedPostsCount", "model.postStream.stream.length")
|
@computed(
|
||||||
selectedAllPosts(selectedPostsCount, postsCount) {
|
"selectedPostsCount",
|
||||||
return selectedPostsCount >= postsCount;
|
"model.postStream.isMegaTopic",
|
||||||
|
"model.postStream.stream.length",
|
||||||
|
"model.posts_count"
|
||||||
|
)
|
||||||
|
selectedAllPosts(
|
||||||
|
selectedPostsCount,
|
||||||
|
isMegaTopic,
|
||||||
|
postsCount,
|
||||||
|
topicPostsCount
|
||||||
|
) {
|
||||||
|
if (isMegaTopic) {
|
||||||
|
return selectedPostsCount >= topicPostsCount;
|
||||||
|
} else {
|
||||||
|
return selectedPostsCount >= postsCount;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
@computed("selectedAllPosts", "model.postStream.isMegaTopic")
|
||||||
|
canSelectAll(selectedAllPosts, isMegaTopic) {
|
||||||
|
return isMegaTopic ? false : !selectedAllPosts;
|
||||||
},
|
},
|
||||||
|
|
||||||
canSelectAll: Ember.computed.not("selectedAllPosts"),
|
|
||||||
canDeselectAll: Ember.computed.alias("selectedAllPosts"),
|
canDeselectAll: Ember.computed.alias("selectedAllPosts"),
|
||||||
|
|
||||||
@computed(
|
@computed(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<p>{{count-i18n key="topic.multi_select.description" count=selectedPostsCount}}</p>
|
<p>{{count-i18n key="topic.multi_select.description" count=selectedPostsCount}}</p>
|
||||||
|
|
||||||
{{#if canSelectAll}}
|
{{#if canSelectAll}}
|
||||||
<p><a href {{action "selectAll"}}>{{i18n 'topic.multi_select.select_all'}}</a></p>
|
<p><a class="select-all" href {{action "selectAll"}}>{{i18n 'topic.multi_select.select_all'}}</a></p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if canDeselectAll}}
|
{{#if canDeselectAll}}
|
||||||
|
@ -252,6 +252,11 @@ QUnit.test("selecting posts", async assert => {
|
|||||||
"it should show the multi select menu"
|
"it should show the multi select menu"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
exists(".select-all"),
|
||||||
|
"it should allow users to select all the posts"
|
||||||
|
);
|
||||||
|
|
||||||
await click(".toggle-admin-menu");
|
await click(".toggle-admin-menu");
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -123,6 +123,16 @@ QUnit.test("selectedAllPosts", function(assert) {
|
|||||||
controller.get("selectedAllPosts"),
|
controller.get("selectedAllPosts"),
|
||||||
"all posts (including filtered posts) are selected"
|
"all posts (including filtered posts) are selected"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
model.setProperties({
|
||||||
|
"postStream.isMegaTopic": true,
|
||||||
|
posts_count: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
controller.get("selectedAllPosts"),
|
||||||
|
"it uses the topic's post count for megatopics"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("selectedPostsUsername", function(assert) {
|
QUnit.test("selectedPostsUsername", function(assert) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user