Skip to content

Commit

Permalink
Merge pull request #11325 from nextcloud/fix/noid/migrate-talk-hash-m…
Browse files Browse the repository at this point in the history
…ixin

follow-up: adjust talkHash store
  • Loading branch information
Antreesy authored Dec 31, 2023
2 parents dce6ea4 + 620bf57 commit 8338e7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/components/LeftSidebar/LeftSidebar.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createLocalVue, mount } from '@vue/test-utils'
import flushPromises from 'flush-promises' // TODO fix after migration to @vue/test-utils v2.0.0
import { cloneDeep } from 'lodash'
import { createPinia, setActivePinia } from 'pinia'
import VueRouter from 'vue-router'
import Vuex from 'vuex'

Expand Down Expand Up @@ -57,6 +58,7 @@ describe('LeftSidebar.vue', () => {
localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(VueRouter)
setActivePinia(createPinia())

loadStateSettings = {
circles_enabled: true,
Expand Down
4 changes: 3 additions & 1 deletion src/components/LeftSidebar/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ export default {
const searchBox = ref(null)
const list = ref(null)

const talkHashStore = useTalkHashStore()
const { initializeNavigation, resetNavigation } = useArrowNavigation(leftSidebar, searchBox, '.list-item')
const isMobile = useIsMobile()

Expand All @@ -373,6 +374,7 @@ export default {
leftSidebar,
searchBox,
list,
talkHashStore,
isMobile,
canModerateSipDialOut,
}
Expand Down Expand Up @@ -559,7 +561,7 @@ export default {
})
break
case 'update-nextcloud-talk-hash':
useTalkHashStore().setNextcloudTalkHash(event.data.hash)
this.talkHashStore.setNextcloudTalkHash(event.data.hash)
break
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/composables/useHashCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

import { watch, computed, ref } from 'vue'
import { watch, computed } from 'vue'

import { showError, TOAST_PERMANENT_TIMEOUT } from '@nextcloud/dialogs'

Expand All @@ -35,18 +35,18 @@ import { useTalkHashStore } from '../stores/talkHash.js'
export function useHashCheck() {
const talkHashStore = useTalkHashStore()

const reloadWarningShown = ref(false)
let reloadWarningShown = false

const isNextcloudTalkHashDirty = computed(() => talkHashStore.isNextcloudTalkHashDirty)

watch(isNextcloudTalkHashDirty, (newValue) => {
if (newValue && !reloadWarningShown.value) {
if (newValue && !reloadWarningShown) {
showReloadWarning()
}
})

const showReloadWarning = () => {
reloadWarningShown.value = true
reloadWarningShown = true

showError(t('spreed', 'Nextcloud Talk was updated, please reload the page'), {
timeout: TOAST_PERMANENT_TIMEOUT,
Expand Down

0 comments on commit 8338e7a

Please sign in to comment.