Fix team switch when there is no history in the team (#5943)

This commit is contained in:
Daniel Espino García
2022-02-08 17:07:49 +01:00
committed by GitHub
parent 22564b8182
commit 8cb7dd2fa9

View File

@@ -59,13 +59,15 @@ export const queryNthLastChannelFromTeam = async (database: Database, teamId: st
if (teamChannelHistory.channelIds.length > n + 1) {
channelId = teamChannelHistory.channelIds[n];
}
} finally {
if (!channelId) {
// No channel history for the team
const channel = await queryDefaultChannelForTeam(database, teamId);
if (channel) {
channelId = channel.id;
}
} catch {
//Do nothing
}
if (!channelId) {
// No channel history for the team
const channel = await queryDefaultChannelForTeam(database, teamId);
if (channel) {
channelId = channel.id;
}
}