仅过滤用户正在调节的频道

Filter channels to only those that user is moderating

我有一个设置,我需要根据用户 ID 是否是群组管理员来显示频道。为了将用户标记为管理员,我将用户提升为版主。

我认为我只需要显示用户当前正在审核的频道列表。有什么方法可以过滤吗?

一种简单的方法是将其作为渠道自定义数据(即 {moderatorId})的一部分进行跟踪,然后使用该属性来匹配查询。

在频道数据上跟踪 moderatorId

const channel = client.channel('messaging', 'travel', {
    moderatorId: 42,
});

channel.update();

检索受监管的频道:

const filter = { moderatorId: 42 };
const sort = { last_message_at: -1 };
const options = {
  state: true,
  watch: true
};

const channels = await authClient.queryChannels(filter, sort, options);