fix reconnect state; correct new channel state (#6574)

This commit is contained in:
Christopher Poile
2022-08-12 16:02:04 -04:00
committed by GitHub
parent da4b7184df
commit 6e3b2c2bd9
5 changed files with 114 additions and 29 deletions

View File

@@ -15,6 +15,7 @@ import {fetchMissingDirectChannelsInfo, fetchMyChannel, fetchChannelStats, fetch
import {fetchPostsForChannel} from '@actions/remote/post';
import {fetchRolesIfNeeded} from '@actions/remote/role';
import {fetchUsersByIds, updateUsersNoLongerVisible} from '@actions/remote/user';
import {loadCallForChannel} from '@calls/actions/calls';
import {Events, Screens} from '@constants';
import DatabaseManager from '@database/manager';
import {queryActiveServer} from '@queries/app/servers';
@@ -293,6 +294,8 @@ export async function handleUserAddedToChannelEvent(serverUrl: string, msg: any)
models.push(...prepared);
}
}
loadCallForChannel(serverUrl, channelId);
} else {
const addedUser = getUserById(database, userId);
if (!addedUser) {

View File

@@ -11,7 +11,8 @@ import {fetchStatusByIds} from '@actions/remote/user';
import {loadConfigAndCalls} from '@calls/actions/calls';
import {
handleCallChannelDisabled,
handleCallChannelEnabled, handleCallEnded,
handleCallChannelEnabled,
handleCallEnded,
handleCallScreenOff,
handleCallScreenOn,
handleCallStarted,
@@ -175,10 +176,6 @@ async function doReconnectRest(serverUrl: string, operator: ServerDataOperator,
const {locale: currentUserLocale} = (await getCurrentUser(database))!;
await deferredAppEntryActions(serverUrl, lastDisconnectedAt, currentUserId, currentUserLocale, prefData.preferences, config, license, teamData, chData, initialTeamId, switchedToChannel ? initialChannelId : undefined);
if (isSupportedServerCalls(config?.Version)) {
loadConfigAndCalls(serverUrl, currentUserId);
}
// https://mattermost.atlassian.net/browse/MM-41520
}
@@ -207,6 +204,11 @@ async function doReconnect(serverUrl: string) {
} else {
await doReconnectRest(serverUrl, operator, system.currentTeamId, system.currentUserId, config, license, lastDisconnectedAt);
}
// Calls is not set up for GraphQL yet
if (isSupportedServerCalls(config?.Version)) {
loadConfigAndCalls(serverUrl, system.currentUserId);
}
}
export async function handleEvent(serverUrl: string, msg: WebSocketMessage) {