Fix an issue where receiving a DM from a new user does not appear in the channel list (#6175)
This commit is contained in:
parent
94b2a14313
commit
667716fd0f
2 changed files with 6 additions and 2 deletions
|
|
@ -214,7 +214,7 @@ export async function handleDirectAddedEvent(serverUrl: string, msg: WebSocketMe
|
|||
}
|
||||
|
||||
const models: Model[] = [];
|
||||
const channelModels = await storeMyChannelsForTeam(serverUrl, '', directChannels, memberships);
|
||||
const channelModels = await storeMyChannelsForTeam(serverUrl, '', directChannels, memberships, true);
|
||||
if (channelModels.models?.length) {
|
||||
models.push(...channelModels.models);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,6 +314,10 @@ export const queryUsersOnChannel = (database: Database, channelId: string) => {
|
|||
};
|
||||
|
||||
export const getMembersCountByChannelsId = async (database: Database, channelsId: string[]) => {
|
||||
const result = channelsId.reduce((r: Record<string, number>, cId) => {
|
||||
r[cId] = 0;
|
||||
return r;
|
||||
}, {});
|
||||
const q = await database.get<ChannelMembershipModel>(CHANNEL_MEMBERSHIP).query(Q.where('channel_id', Q.oneOf(channelsId))).fetch();
|
||||
return q.reduce((r: Record<string, number>, m) => {
|
||||
if (r[m.channelId]) {
|
||||
|
|
@ -323,7 +327,7 @@ export const getMembersCountByChannelsId = async (database: Database, channelsId
|
|||
|
||||
r[m.channelId] = 1;
|
||||
return r;
|
||||
}, {});
|
||||
}, result);
|
||||
};
|
||||
|
||||
export const queryChannelsByTypes = (database: Database, channelTypes: ChannelType[]) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue