我可以使用 findFilteredTopics 来获取私信(Pms)吗?

我想做类似 GitHub - nolosb/discourse-featured-lists: A Discourse theme component to feature custom topic lists. 的事情,让私信显示在其他页面(如 latest)。
我的想法是,群组私信很难找到,所以如果我能让未读的群组私信显示在 /unread 页面,那就太棒了。
假设我能弄清楚如何显示它们,我需要获取数据以便显示。
我能这样做吗?

    const topicList = await this.store.findFiltered('topicList', {
      filter: this.args.list.filter,
      params: {
        category: this.args.list.category,
        tags: this.args.list.tag,
        solved: solvedFilter,
      },
    });

但是让 params 获取,比如说,员工或团队的群组私信?

3 个赞

好吧,看起来我可以这样做:

    const topicList = await this.store.findFiltered('topicList', {
      filter: this.args.list.filter,
      // filter: "search",
      params: {
        // category: this.args.list.category,
        // tags: this.args.list.tag,
        // solved: solvedFilter,
        q: "upgraded in:messages"
      },
    });

这样我就可以得到包含“upgraded”的消息。

但我仍然无法弄清楚如何获取未读消息、新消息、所有消息、发送给群组的消息等。

唉。但它不是一个 topic_list。

2 个赞

但是等等!!!我在以下位置找到了正确的过滤器:

    let topicListFilter = `topics/private-messages-group/${this.currentUser.username}/${groupName}`;
    console.log("考虑主题列表", topicListFilter);
    const topicList = await this.store.findFiltered('topicList', {
      filter: topicListFilter,
      params: { },
    });
2 个赞