From e84acf794f919c220e712d6b932658cbc72c2b91 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Thu, 15 Aug 2024 12:39:47 +0200 Subject: [PATCH 1/2] fix(federation): switch from loadState to getTalkConfig for checking federation - Desktop relies on capabilities rather that initial state Signed-off-by: Maksim Sukharev --- src/components/LeftSidebar/LeftSidebar.vue | 3 +-- src/components/RightSidebar/Participants/ParticipantsTab.vue | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/LeftSidebar/LeftSidebar.vue b/src/components/LeftSidebar/LeftSidebar.vue index 99c2a1ac315..8aa807d5568 100644 --- a/src/components/LeftSidebar/LeftSidebar.vue +++ b/src/components/LeftSidebar/LeftSidebar.vue @@ -353,7 +353,7 @@ import CancelableRequest from '../../utils/cancelableRequest.js' import { hasUnreadMentions, filterFunction } from '../../utils/conversation.js' import { requestTabLeadership } from '../../utils/requestTabLeadership.js' -const isFederationEnabled = loadState('spreed', 'federation_enabled') +const isFederationEnabled = getTalkConfig('local', 'federation', 'enabled') const canModerateSipDialOut = hasTalkFeature('local', 'sip-support-dialout') && getTalkConfig('local', 'call', 'sip-enabled') && getTalkConfig('local', 'call', 'sip-dialout-enabled') @@ -419,7 +419,6 @@ export default { talkHashStore, isMobile, canModerateSipDialOut, - isFederationEnabled, canNoteToSelf, } }, diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue index eb51995f570..a635dbca334 100644 --- a/src/components/RightSidebar/Participants/ParticipantsTab.vue +++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue @@ -67,7 +67,6 @@ import IconInformationOutline from 'vue-material-design-icons/InformationOutline import { showError } from '@nextcloud/dialogs' import { subscribe, unsubscribe } from '@nextcloud/event-bus' -import { loadState } from '@nextcloud/initial-state' import { t } from '@nextcloud/l10n' import NcAppNavigationCaption from '@nextcloud/vue/dist/Components/NcAppNavigationCaption.js' @@ -92,7 +91,7 @@ import { EventBus } from '../../../services/EventBus.js' import { addParticipant } from '../../../services/participantsService.js' import CancelableRequest from '../../../utils/cancelableRequest.js' -const isFederationEnabled = loadState('spreed', 'federation_enabled') +const isFederationEnabled = getTalkConfig('local', 'federation', 'enabled') export default { name: 'ParticipantsTab', From 6e24d74c73e5d981c73d3cd2f06723b53f040ac7 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Thu, 15 Aug 2024 13:05:39 +0200 Subject: [PATCH 2/2] fix(capabilities): clean up remnant configurations - unknown tokens - local tokens Signed-off-by: Maksim Sukharev --- src/services/CapabilitiesManager.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/services/CapabilitiesManager.ts b/src/services/CapabilitiesManager.ts index 1813551b6e1..bea0524b00b 100644 --- a/src/services/CapabilitiesManager.ts +++ b/src/services/CapabilitiesManager.ts @@ -149,14 +149,20 @@ function restoreRemoteCapabilities(): RemoteCapabilities { // Migration step for capabilities based on token let hasMigrated = false - Object.keys(remoteCapabilities).forEach(key => { + const knownRemoteServers = Object.values(remoteTokenMap).filter(Boolean) + + for (const key of Object.keys(remoteCapabilities)) { + if (knownRemoteServers.includes(key)) { + continue + } const remoteServer = remoteTokenMap[key] if (remoteServer) { remoteCapabilities[remoteServer] = remoteCapabilities[key] - delete remoteCapabilities[key] - hasMigrated = true } - }) + + delete remoteCapabilities[key] + hasMigrated = true + } if (hasMigrated) { BrowserStorage.setItem('remoteCapabilities', JSON.stringify(remoteCapabilities)) }