FIX: dismiss new button for tags on top (#12628)

Currently, new topics for specific tags can be dismissed with the button at the bottom of the page.

When there is more than 15 new topics, we should display the same button at the top as well. It already works in the same manner for categories.
This commit is contained in:
Krzysztof Kotlarek 2021-04-08 10:46:08 +10:00 committed by GitHub
parent 5da7e0c8e5
commit 8b735e6f9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View File

@ -110,6 +110,15 @@ export default Controller.extend(BulkTopicSelection, FilterModeMixin, {
return this.isFilterPage(filter, "new") && topicsLength > 0;
},
@discourseComputed("list.filter", "list.topics.length")
showDismissAtTop(filter, topicsLength) {
return (
(this.isFilterPage(filter, "new") ||
this.isFilterPage(filter, "unread")) &&
topicsLength >= 15
);
},
actions: {
dismissReadPosts() {
showModal("dismiss-read", { title: "topics.bulk.dismiss_read" });

View File

@ -2,7 +2,6 @@
<div class="container">
{{discourse-banner user=currentUser banner=site.banner}}
</div>
<div class="list-controls">
<div class="container">
<section class="navigation-container tag-navigation">
@ -32,6 +31,28 @@
{{plugin-outlet name="discovery-list-container-top" args=(hash category=category)}}
{{#if showDismissAtTop}}
<div class="row dismiss-container-top">
{{#if showDismissRead}}
{{d-button
class="btn-default dismiss-read"
id="dismiss-topics"
action=(action "dismissReadPosts")
title="topics.bulk.dismiss_tooltip"
label="topics.bulk.dismiss_button"}}
{{/if}}
{{#if showResetNew}}
{{d-button
class="btn-default dismiss-read"
action=(action "resetNew")
id="dismiss-new"
icon="check"
label="topics.bulk.dismiss_new"}}
{{/if}}
</div>
{{/if}}
<div class="container list-container">
<div class="row">
<div class="full-width">