Skip to content

Commit

Permalink
Merge pull request #12992 from nextcloud/fix/12861/capabilities-adjust
Browse files Browse the repository at this point in the history
fix(capabilities): minor adjustments for federation
  • Loading branch information
Antreesy authored Aug 15, 2024
2 parents 85b31b6 + 6e24d74 commit 1042403
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/components/LeftSidebar/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -419,7 +419,6 @@ export default {
talkHashStore,
isMobile,
canModerateSipDialOut,
isFederationEnabled,
canNoteToSelf,
}
},
Expand Down
3 changes: 1 addition & 2 deletions src/components/RightSidebar/Participants/ParticipantsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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',
Expand Down
14 changes: 10 additions & 4 deletions src/services/CapabilitiesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 1042403

Please sign in to comment.