diff --git a/src/components/TopBar/CallButton.vue b/src/components/TopBar/CallButton.vue index 70179c6b812..44d16217171 100644 --- a/src/components/TopBar/CallButton.vue +++ b/src/components/TopBar/CallButton.vue @@ -217,6 +217,7 @@ export default { }, isNextcloudTalkHashDirty() { return this.talkHashStore.isNextcloudTalkHashDirty + || this.talkHashStore.isNextcloudTalkProxyHashDirty[this.token] }, container() { return this.$store.getters.getMainContainerSelector() diff --git a/src/services/CapabilitiesManager.ts b/src/services/CapabilitiesManager.ts index 471ac450e0c..3324a607480 100644 --- a/src/services/CapabilitiesManager.ts +++ b/src/services/CapabilitiesManager.ts @@ -9,6 +9,7 @@ import { t } from '@nextcloud/l10n' import { getRemoteCapabilities } from './federationService.ts' import BrowserStorage from '../services/BrowserStorage.js' +import { useTalkHashStore } from '../stores/talkHash.js' import type { Capabilities, JoinRoomFullResponse } from '../types' type Config = Capabilities['spreed']['config'] @@ -40,7 +41,7 @@ export function hasTalkFeature(token: string = 'local', feature: string): boolea * @param key2 second-level key (e.g. 'allowed') */ export function getTalkConfig(token: string = 'local', key1: keyof Config, key2: keyof Config[keyof Config]) { - if (localCapabilities?.spreed?.['config-local']?.[key1]?.[key2]) { + if (localCapabilities?.spreed?.['config-local']?.[key1]?.includes(key2)) { return localCapabilities?.spreed?.config?.[key1]?.[key2] } else if (token === 'local' || !remoteCapabilities[token]) { return localCapabilities?.spreed?.config?.[key1]?.[key2] @@ -62,6 +63,10 @@ export async function setRemoteCapabilities(joinRoomResponse: JoinRoomFullRespon return } + // Mark the hash as dirty to prevent any activity in the conversation + const talkHashStore = useTalkHashStore() + talkHashStore.setTalkProxyHashDirty(token) + const response = await getRemoteCapabilities(token) if (Array.isArray(response.data.ocs.data)) { // unknown[] received from server, nothing to update with diff --git a/src/stores/talkHash.js b/src/stores/talkHash.js index 430ba0b11f3..0fe18004a29 100644 --- a/src/stores/talkHash.js +++ b/src/stores/talkHash.js @@ -4,6 +4,7 @@ */ import { defineStore } from 'pinia' +import Vue from 'vue' import { showError, TOAST_PERMANENT_TIMEOUT } from '@nextcloud/dialogs' import { t } from '@nextcloud/l10n' @@ -12,9 +13,10 @@ import { talkBroadcastChannel } from '../services/talkBroadcastChannel.js' /** * @typedef {object} State - * @property {string} initialNextcloudTalkHash - The absence status per conversation. - * @property {boolean} isNextcloudTalkHashDirty - The parent message id to reply per conversation. - * @property {object|null} maintenanceWarningToast -The input value per conversation. + * @property {string} initialNextcloudTalkHash - the 'default' Talk hash to compare with. + * @property {boolean} isNextcloudTalkHashDirty - whether Talk hash was updated and requires a reload. + * @property {object} isNextcloudTalkProxyHashDirty - whether Talk hash in federated conversation was updated. + * @property {object|null} maintenanceWarningToast - a toast object. */ /** @@ -27,6 +29,7 @@ export const useTalkHashStore = defineStore('talkHash', { state: () => ({ initialNextcloudTalkHash: '', isNextcloudTalkHashDirty: false, + isNextcloudTalkProxyHashDirty: {}, maintenanceWarningToast: null, }), @@ -46,6 +49,16 @@ export const useTalkHashStore = defineStore('talkHash', { } }, + /** + * Mark the current Talk Federation hash as dirty + * + * @param {string} token federated conversation token + */ + setTalkProxyHashDirty(token) { + console.debug('X-Nextcloud-Talk-Proxy-Hash marked dirty: ', token) + Vue.set(this.isNextcloudTalkProxyHashDirty, token, true) + }, + /** * Updates a Talk hash from a response *