mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
DEV: Update user-topics-list to native class syntax (#23263)
This commit is contained in:
parent
90ef8d3041
commit
3081d83ac5
|
@ -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");
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user