Skip to content

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

DEV: Remove dedicated mobile template for discovery/topics (#23179)

David Taylor71ff3417a6d8
diff --git a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js b/app/assets/javascripts/discourse/app/controllers/discovery/topics.js
index dcb874d7295..a87580e1f05 100644
--- a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js
+++ b/app/assets/javascripts/discourse/app/controllers/discovery/topics.js
@@ -204,4 +204,12 @@ export default class TopicsController extends DiscoveryController.extend(
),
});
}
+
+ get renderNewListHeaderControls() {
+ return (
+ this.site.mobileView &&
+ this.get("showTopicsAndRepliesToggle") &&
+ !this.get("bulkSelectEnabled")
+ );
+ }
}
diff --git a/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs b/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs
index e0c14f2ad24..84d60370722 100644
--- a/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs
+++ b/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs
@@ -62,6 +62,16 @@
</div>
{{/if}}
{{/if}}
+
+ {{#if this.renderNewListHeaderControls}}
+ <NewListHeaderControlsWrapper
+ @current={{this.model.params.subset}}
+ @newRepliesCount={{this.newRepliesCount}}
+ @newTopicsCount={{this.newTopicsCount}}
+ @changeNewListSubset={{route-action "changeNewListSubset"}}
+ />
+ {{/if}}
+
<span>
<PluginOutlet
@name="before-topic-list"
diff --git a/app/assets/javascripts/discourse/app/templates/mobile/discovery/topics.hbs b/app/assets/javascripts/discourse/app/templates/mobile/discovery/topics.hbs
deleted file mode 100644
index d3d51bc9749..00000000000
--- a/app/assets/javascripts/discourse/app/templates/mobile/discovery/topics.hbs
+++ /dev/null
@@ -1,120 +0,0 @@
-{{#if (or this.loading this.model.canLoadMore)}}
- {{hide-application-footer}}
-{{/if}}
-
-<TopicDismissButtons
- @position="top"
- @selectedTopics={{this.selected}}
- @model={{this.model}}
- @showResetNew={{this.showResetNew}}
- @showDismissRead={{this.showDismissRead}}
- @resetNew={{action "resetNew"}}
-/>
-
-<DiscoveryTopicsList
- @model={{this.model}}
- @refresh={{action "refresh"}}
- @incomingCount={{this.topicTrackingState.incomingCount}}
->
- {{#if this.top}}
- <div class="top-lists">
- <PeriodChooser
- @period={{this.period}}
- @action={{action "changePeriod"}}
- @fullDay={{false}}
- />
- </div>
- {{else}}
- {{#if this.topicTrackingState.hasIncoming}}
- <a
- href
- {{on "click" this.showInserted}}
- class="alert alert-info clickable"
- >
- <CountI18n
- @key="topic_count_"
- @suffix={{this.topicTrackingState.filter}}
- @count={{this.topicTrackingState.incomingCount}}
- />
- </a>
- {{/if}}
- {{/if}}
- {{#unless this.bulkSelectEnabled}}
- {{#if this.showTopicsAndRepliesToggle}}
- <NewListHeaderControlsWrapper
- @current={{this.model.params.subset}}
- @newRepliesCount={{this.newRepliesCount}}
- @newTopicsCount={{this.newTopicsCount}}
- @changeNewListSubset={{route-action "changeNewListSubset"}}
- />
- {{/if}}
- {{/unless}}
- {{#if this.hasTopics}}
- <TopicList
- @ascending={{this.ascending}}
- @highlightLastVisited={{true}}
- @showPosters={{true}}
- @canBulkSelect={{this.canBulkSelect}}
- @toggleBulkSelect={{action "toggleBulkSelect"}}
- @updateAutoAddTopicsToBulkSelect={{action
- "updateAutoAddTopicsToBulkSelect"
- }}
- @hideCategory={{this.model.hideCategory}}
- @order={{this.order}}
- @bulkSelectEnabled={{this.bulkSelectEnabled}}
- @bulkSelectAction={{action "refresh"}}
- @selected={{this.selected}}
- @expandGloballyPinned={{this.expandGloballyPinned}}
- @expandAllPinned={{this.expandAllPinned}}
- @category={{this.category}}
- @topics={{this.model.topics}}
- />
- {{/if}}
-</DiscoveryTopicsList>
-
-<footer class="topic-list-bottom">
- <ConditionalLoadingSpinner @condition={{this.model.loadingMore}} />
- {{#if this.allLoaded}}
- <TopicDismissButtons
- @position="bottom"
- @selectedTopics={{this.selected}}
- @model={{this.model}}
- @showResetNew={{this.showResetNew}}
- @showDismissRead={{this.showDismissRead}}
- @resetNew={{action "resetNew"}}
- />
-
- <FooterMessage
- @education={{this.footerEducation}}
- @message={{this.footerMessage}}
- >
- {{#if this.latest}}
- {{#if this.category.canCreateTopic}}
- <DiscourseLinkedText
- @action={{fn
- this.composer.openNewTopic
- (hash category=this.category preferDraft=true)
- }}
- @text="topic.suggest_create_topic"
- />
- {{/if}}
- {{else if this.top}}
- {{html-safe
- (i18n
- "topic.browse_all_categories_latest_or_top" basePath=(base-path)
- )
- }}
- <TopPeriodButtons
- @period={{this.period}}
- @action={{action "changePeriod"}}
- />
- {{else}}
- {{html-safe
- (i18n "topic.browse_all_categories_latest" basePath=(base-path))
- }}
- {{/if}}
- </FooterMessage>
- {{else}}
- {{hide-application-footer}}
- {{/if}}
-</footer>
\ No newline at end of file