mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-22 18:43:33 +00:00
fix: gate mark-as-read by route, clear stale lastInboxPath on load
This commit is contained in:
@@ -197,7 +197,8 @@ watch(
|
||||
if (path.startsWith('/inboxes') && path !== '/inboxes/search') {
|
||||
lastInboxPath.value = path
|
||||
}
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
const userStore = useUserStore()
|
||||
const conversationStore = useConversationStore()
|
||||
|
||||
@@ -9,22 +9,18 @@ export const useAiPromptStore = defineStore('aiPrompt', () => {
|
||||
const prompts = ref([])
|
||||
const emitter = useEmitter()
|
||||
let inflight = null
|
||||
const fetchPrompts = async () => {
|
||||
if (prompts.value.length) return
|
||||
const fetchPrompts = () => {
|
||||
if (prompts.value.length) return Promise.resolve()
|
||||
if (inflight) return inflight
|
||||
inflight = (async () => {
|
||||
try {
|
||||
const response = await api.getAiPrompts()
|
||||
prompts.value = response?.data?.data || []
|
||||
} catch (error) {
|
||||
inflight = api.getAiPrompts()
|
||||
.then(response => { prompts.value = response?.data?.data || [] })
|
||||
.catch(error => {
|
||||
emitter.emit(EMITTER_EVENTS.SHOW_TOAST, {
|
||||
variant: 'destructive',
|
||||
description: handleHTTPError(error).message
|
||||
})
|
||||
} finally {
|
||||
inflight = null
|
||||
}
|
||||
})()
|
||||
})
|
||||
.finally(() => { inflight = null })
|
||||
return inflight
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, reactive, ref, watchEffect } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { handleHTTPError } from '@shared-ui/utils/http.js'
|
||||
import { TYPING_RECEIVE_TIMEOUT } from '@shared-ui/composables/useTypingIndicator.js'
|
||||
import { deepMerge } from '@shared-ui/utils/object.js'
|
||||
@@ -27,6 +28,8 @@ export const useConversationStore = defineStore('conversation', () => {
|
||||
const macros = ref({})
|
||||
const drafts = ref(new Map())
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
const isViewingConversation = (uuid) => router.currentRoute.value.params.uuid === uuid
|
||||
|
||||
const selectedUUIDs = ref(new Set())
|
||||
|
||||
@@ -763,6 +766,7 @@ export const useConversationStore = defineStore('conversation', () => {
|
||||
}
|
||||
|
||||
async function updateAssigneeLastSeen (uuid) {
|
||||
if (!isViewingConversation(uuid)) return
|
||||
markConversationAsRead(uuid)
|
||||
api.updateAssigneeLastSeen(uuid).catch(() => { })
|
||||
}
|
||||
|
||||
@@ -27,22 +27,18 @@ export const useCustomAttributeStore = defineStore('customAttributes', () => {
|
||||
}))
|
||||
})
|
||||
let inflight = null
|
||||
const fetchCustomAttributes = async () => {
|
||||
if (attributes.value.length) return
|
||||
const fetchCustomAttributes = () => {
|
||||
if (attributes.value.length) return Promise.resolve()
|
||||
if (inflight) return inflight
|
||||
inflight = (async () => {
|
||||
try {
|
||||
const response = await api.getCustomAttributes()
|
||||
attributes.value = response?.data?.data || []
|
||||
} catch (error) {
|
||||
inflight = api.getCustomAttributes()
|
||||
.then(response => { attributes.value = response?.data?.data || [] })
|
||||
.catch(error => {
|
||||
emitter.emit(EMITTER_EVENTS.SHOW_TOAST, {
|
||||
variant: 'destructive',
|
||||
description: handleHTTPError(error).message
|
||||
})
|
||||
} finally {
|
||||
inflight = null
|
||||
}
|
||||
})()
|
||||
})
|
||||
.finally(() => { inflight = null })
|
||||
return inflight
|
||||
}
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user