Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(capabilities): minor adjustments for federation #12992

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading