FIX: empty state message on the group messages pages (#14371)
This commit is contained in:
parent
a842ea8e6e
commit
b6ccc9c37a
|
@ -1,5 +1,5 @@
|
||||||
import I18n from "I18n";
|
|
||||||
import createPMRoute from "discourse/routes/build-private-messages-route";
|
import createPMRoute from "discourse/routes/build-private-messages-route";
|
||||||
|
import I18n from "I18n";
|
||||||
import { findOrResetCachedTopicList } from "discourse/lib/cached-topic-list";
|
import { findOrResetCachedTopicList } from "discourse/lib/cached-topic-list";
|
||||||
|
|
||||||
export default (inboxType, filter) => {
|
export default (inboxType, filter) => {
|
||||||
|
@ -35,7 +35,16 @@ export default (inboxType, filter) => {
|
||||||
|
|
||||||
return lastTopicList
|
return lastTopicList
|
||||||
? lastTopicList
|
? lastTopicList
|
||||||
: this.store.findFiltered("topicList", { filter: topicListFilter });
|
: this.store
|
||||||
|
.findFiltered("topicList", { filter: topicListFilter })
|
||||||
|
.then((topicList) => {
|
||||||
|
// andrei: we agreed that this is an anti pattern,
|
||||||
|
// it's better to avoid mutating a rest model like this
|
||||||
|
// this place we'll be refactored later
|
||||||
|
// see https://github.com/discourse/discourse/pull/14313#discussion_r708784704
|
||||||
|
topicList.set("emptyState", this.emptyState());
|
||||||
|
return topicList;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
|
@ -69,6 +78,13 @@ export default (inboxType, filter) => {
|
||||||
this.controllerFor("user-private-messages").set("group", this.group);
|
this.controllerFor("user-private-messages").set("group", this.group);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emptyState() {
|
||||||
|
return {
|
||||||
|
title: I18n.t("user.no_messages_title"),
|
||||||
|
body: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
dismissReadOptions() {
|
dismissReadOptions() {
|
||||||
return {
|
return {
|
||||||
group_name: this.get("groupName"),
|
group_name: this.get("groupName"),
|
||||||
|
|
Loading…
Reference in New Issue