From a058eddb21eebafc651055eaaf9827641b5742d5 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Wed, 30 Mar 2022 08:04:58 -0300 Subject: [PATCH] [Gekidou] multi server fixes (#6102) --- app/actions/remote/channel.ts | 2 +- app/actions/remote/entry/app.ts | 2 +- app/actions/remote/entry/notification.ts | 2 +- .../operator/server_data_operator/transformers/channel.ts | 2 +- app/init/credentials.ts | 2 +- app/utils/user/index.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/actions/remote/channel.ts b/app/actions/remote/channel.ts index c17da7d8c..ff77fe631 100644 --- a/app/actions/remote/channel.ts +++ b/app/actions/remote/channel.ts @@ -286,7 +286,7 @@ export const fetchMissingSidebarInfo = async (serverUrl: string, directChannels: if (data.users.length > 1) { displayNameByChannel[data.channelId] = displayGroupMessageName(data.users, locale, teammateDisplayNameSetting, currentUserId); } else { - displayNameByChannel[data.channelId] = displayUsername(data.users[0], locale, teammateDisplayNameSetting); + displayNameByChannel[data.channelId] = displayUsername(data.users[0], locale, teammateDisplayNameSetting, false); } } }); diff --git a/app/actions/remote/entry/app.ts b/app/actions/remote/entry/app.ts index c9236c5a0..cabff6bf4 100644 --- a/app/actions/remote/entry/app.ts +++ b/app/actions/remote/entry/app.ts @@ -79,7 +79,7 @@ export const appEntry = async (serverUrl: string, since = 0) => { const {id: currentUserId, locale: currentUserLocale} = meData.user || (await getCurrentUser(database))!; const {config, license} = await getCommonSystemValues(database); - deferredAppEntryActions(serverUrl, lastDisconnectedAt, currentUserId, currentUserLocale, prefData.preferences, config, license, teamData, chData, initialTeamId); + await deferredAppEntryActions(serverUrl, lastDisconnectedAt, currentUserId, currentUserLocale, prefData.preferences, config, license, teamData, chData, initialTeamId); if (!since) { // Load data from other servers diff --git a/app/actions/remote/entry/notification.ts b/app/actions/remote/entry/notification.ts index f8322d759..b98138cdb 100644 --- a/app/actions/remote/entry/notification.ts +++ b/app/actions/remote/entry/notification.ts @@ -137,7 +137,7 @@ export const pushNotificationEntry = async (serverUrl: string, notification: Not const {id: currentUserId, locale: currentUserLocale} = meData.user || (await getCurrentUser(operator.database))!; const {config, license} = await getCommonSystemValues(operator.database); - deferredAppEntryActions(serverUrl, lastDisconnectedAt, currentUserId, currentUserLocale, prefData.preferences, config, license, teamData, chData, selectedTeamId, selectedChannelId); + await deferredAppEntryActions(serverUrl, lastDisconnectedAt, currentUserId, currentUserLocale, prefData.preferences, config, license, teamData, chData, selectedTeamId, selectedChannelId); syncOtherServers(serverUrl); const error = teamData.error || chData?.error || prefData.error || meData.error; return {error, userId: meData?.user?.id}; diff --git a/app/database/operator/server_data_operator/transformers/channel.ts b/app/database/operator/server_data_operator/transformers/channel.ts index 4e4bd466a..576a45fad 100644 --- a/app/database/operator/server_data_operator/transformers/channel.ts +++ b/app/database/operator/server_data_operator/transformers/channel.ts @@ -43,7 +43,7 @@ export const transformChannelRecord = ({action, database, value}: TransformerArg // for DM & GM's channels do not override the display name // until we get the new info if there is any let displayName; - if (raw.type === General.DM_CHANNEL && record?.displayName) { + if (raw.type === General.DM_CHANNEL && (record?.displayName || raw.display_name)) { displayName = raw.display_name || record?.displayName; } else if (raw.type === General.GM_CHANNEL) { const rawMembers = raw.display_name.split(',').length; diff --git a/app/init/credentials.ts b/app/init/credentials.ts index cbf0b86e6..2a7506f28 100644 --- a/app/init/credentials.ts +++ b/app/init/credentials.ts @@ -33,7 +33,7 @@ export const getAllServerCredentials = async (): Promise => export const getActiveServerUrl = async () => { let serverUrl = await DatabaseManager.getActiveServerUrl(); - if (serverUrl) { + if (!serverUrl) { let serverUrls: string[]; if (Platform.OS === 'ios') { serverUrls = await KeyChain.getAllInternetPasswordServers(); diff --git a/app/utils/user/index.ts b/app/utils/user/index.ts index e6ca5d4fe..62239d8db 100644 --- a/app/utils/user/index.ts +++ b/app/utils/user/index.ts @@ -40,7 +40,7 @@ export function displayGroupMessageName(users: Array, l users.forEach((u) => { if (u.id !== excludeUserId) { - names.push(displayUsername(u, locale, teammateDisplayNameSetting)); + names.push(displayUsername(u, locale, teammateDisplayNameSetting, false)); } });