From 3081d83ac55509813824d13d7c0808cceb010154 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 25 Aug 2023 10:57:44 +0100 Subject: [PATCH] DEV: Update user-topics-list to native class syntax (#23263) --- .../app/controllers/user-topics-list.js | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/discourse/app/controllers/user-topics-list.js b/app/assets/javascripts/discourse/app/controllers/user-topics-list.js index 25c6918700a..548a2e380c3 100644 --- a/app/assets/javascripts/discourse/app/controllers/user-topics-list.js +++ b/app/assets/javascripts/discourse/app/controllers/user-topics-list.js @@ -11,35 +11,38 @@ import { } from "discourse/routes/build-private-messages-route"; // Lists of topics on a user's page. -export default Controller.extend(BulkTopicSelection, { - hideCategory: false, - showPosters: false, - channel: null, - tagsForUser: null, - incomingCount: reads("pmTopicTrackingState.newIncoming.length"), +export default class UserTopicsListController extends Controller.extend( + BulkTopicSelection +) { + hideCategory = false; + showPosters = false; + channel = null; + tagsForUser = null; + + @reads("pmTopicTrackingState.newIncoming.length") incomingCount; @discourseComputed("model.topics.length", "incomingCount") noContent(topicsLength, incomingCount) { return topicsLength === 0 && incomingCount === 0; - }, + } @discourseComputed("filter", "model.topics.length") showResetNew(filter, hasTopics) { return filter === NEW_FILTER && hasTopics; - }, + } @discourseComputed("filter", "model.topics.length") showDismissRead(filter, hasTopics) { return filter === UNREAD_FILTER && hasTopics; - }, + } subscribe() { this.pmTopicTrackingState.trackIncoming(this.inbox, this.filter); - }, + } unsubscribe() { this.pmTopicTrackingState.stopIncomingTracking(); - }, + } @action resetNew() { @@ -62,22 +65,22 @@ export default Controller.extend(BulkTopicSelection, { this.send("refresh"); } }); - }, + } @action loadMore() { this.model.loadMore(); - }, + } @action showInserted(event) { event?.preventDefault(); this.model.loadBefore(this.pmTopicTrackingState.newIncoming); this.pmTopicTrackingState.resetIncomingTracking(); - }, + } @action refresh() { this.send("triggerRefresh"); - }, -}); + } +}