Skip to content

A platform for community discussion. Free, open, simple.

FIX: Tag show - hide no topics footer until there are no topics (#15756)

Mark VanLandingham2644813c99fd
diff --git a/app/assets/javascripts/discourse/app/controllers/tag-show.js b/app/assets/javascripts/discourse/app/controllers/tag-show.js
index 2a50cf829df..be4cbdd6692 100644
--- a/app/assets/javascripts/discourse/app/controllers/tag-show.js
+++ b/app/assets/javascripts/discourse/app/controllers/tag-show.js
@@ -69,10 +69,6 @@ export default Controller.extend(BulkTopicSelection, FilterModeMixin, {
return true;
},
- loadMoreTopics() {
- return this.list.loadMore();
- },
-
@observes("list.canLoadMore")
_showFooter() {
this.set("application.showFooter", !this.get("list.canLoadMore"));
diff --git a/app/assets/javascripts/discourse/app/templates/tags/show.hbs b/app/assets/javascripts/discourse/app/templates/tags/show.hbs
index c5173b04dd9..917209dd74c 100644
--- a/app/assets/javascripts/discourse/app/templates/tags/show.hbs
+++ b/app/assets/javascripts/discourse/app/templates/tags/show.hbs
@@ -96,9 +96,11 @@
{{topic-dismiss-buttons position="bottom" selectedTopics=selected
model=model showResetNew=showResetNew showDismissRead=showDismissRead resetNew=(action "resetNew")}}
- {{#footer-message education=footerEducation message=footerMessage}}
- {{#link-to "tags"}} {{i18n "topic.browse_all_tags"}}{{/link-to}} {{i18n "or"}} {{#link-to "discovery.latest"}}{{i18n "topic.view_latest_topics"}}{{/link-to}}.
- {{/footer-message}}
+ {{#unless list.canLoadMore}}
+ {{#footer-message education=footerEducation message=footerMessage}}
+ {{#link-to "tags"}} {{i18n "topic.browse_all_tags"}}{{/link-to}} {{i18n "or"}} {{#link-to "discovery.latest"}}{{i18n "topic.view_latest_topics"}}{{/link-to}}.
+ {{/footer-message}}
+ {{/unless}}
</footer>
{{/unless}}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js
index e6c77c7572a..1b8ea803d4e 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js
@@ -522,3 +522,46 @@ acceptance("Tag info", function (needs) {
assert.strictEqual(composer.get("model").tags, undefined);
});
});
+
+acceptance(
+ "Tag show - topic list with `more_topics_url` present",
+ function (needs) {
+ needs.pretender((server, helper) => {
+ server.get("/tag/:tagName/l/latest.json", () =>
+ helper.response({
+ users: [],
+ primary_groups: [],
+ topic_list: {
+ topics: [],
+ more_topics_url: "...",
+ },
+ })
+ );
+ server.put("/topics/bulk", () => helper.response({}));
+ });
+
+ test("load more footer message is present", async function (assert) {
+ await visit("/tag/planters");
+ assert.notOk(exists(".topic-list-bottom .footer-message"));
+ });
+ }
+);
+
+acceptance("Tag show - topic list without `more_topics_url`", function (needs) {
+ needs.pretender((server, helper) => {
+ server.get("/tag/:tagName/l/latest.json", () =>
+ helper.response({
+ users: [],
+ primary_groups: [],
+ topic_list: {
+ topics: [],
+ },
+ })
+ );
+ server.put("/topics/bulk", () => helper.response({}));
+ });
+ test("load more footer message is not present", async function (assert) {
+ await visit("/tag/planters");
+ assert.ok(exists(".topic-list-bottom .footer-message"));
+ });
+});