Skip to content
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
1 change: 1 addition & 0 deletions src/components/TopBar/CallButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export default {
},
isNextcloudTalkHashDirty() {
return this.talkHashStore.isNextcloudTalkHashDirty
|| this.talkHashStore.isNextcloudTalkProxyHashDirty[this.token]
},
container() {
return this.$store.getters.getMainContainerSelector()
Expand Down
7 changes: 6 additions & 1 deletion src/services/CapabilitiesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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]
Expand All @@ -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
Expand Down
19 changes: 16 additions & 3 deletions src/stores/talkHash.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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.
*/

/**
Expand All @@ -27,6 +29,7 @@ export const useTalkHashStore = defineStore('talkHash', {
state: () => ({
initialNextcloudTalkHash: '',
isNextcloudTalkHashDirty: false,
isNextcloudTalkProxyHashDirty: {},
maintenanceWarningToast: null,
}),

Expand All @@ -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
*
Expand Down