mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-22 10:33:24 +00:00
fix apply status update after send confirmation dialogs.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>{{ $t('globals.messages.cancel') }}</AlertDialogCancel>
|
||||
<AlertDialogAction @click="processSend(true, true)">{{
|
||||
<AlertDialogAction @click="processSend(true, true, deferredStatus)">{{
|
||||
$t('replyBox.sendAnyway')
|
||||
}}</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
@@ -30,7 +30,7 @@
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>{{ $t('globals.messages.cancel') }}</AlertDialogCancel>
|
||||
<AlertDialogAction @click="processSend(false, true)">{{
|
||||
<AlertDialogAction @click="processSend(false, true, deferredStatus)">{{
|
||||
$t('replyBox.sendAnyway')
|
||||
}}</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
@@ -249,6 +249,7 @@ const aiPrompts = computed(() => aiPromptStore.prompts)
|
||||
const replyBoxContentRef = ref(null)
|
||||
const showContactEmailWarning = ref(false)
|
||||
const showMissingTagsWarning = ref(false)
|
||||
const deferredStatus = ref(null)
|
||||
const mentions = ref([])
|
||||
|
||||
aiPromptStore.fetchPrompts()
|
||||
@@ -307,10 +308,7 @@ const hasTextContent = computed(() => {
|
||||
return textContent.value.trim().length > 0
|
||||
})
|
||||
|
||||
/**
|
||||
* Processes the send action.
|
||||
*/
|
||||
const processSend = async (skipContactEmailCheck = false, skipMissingTagsCheck = false) => {
|
||||
const processSend = async (skipContactEmailCheck = false, skipMissingTagsCheck = false, statusToSet = null) => {
|
||||
let hasMessageSendingErrored = false
|
||||
isEditorFullscreen.value = false
|
||||
|
||||
@@ -329,6 +327,7 @@ const processSend = async (skipContactEmailCheck = false, skipMissingTagsCheck =
|
||||
currentInbox?.prompt_tags_on_reply &&
|
||||
!(conversationStore.current.tags?.length > 0)
|
||||
) {
|
||||
deferredStatus.value = statusToSet
|
||||
showMissingTagsWarning.value = true
|
||||
return
|
||||
}
|
||||
@@ -354,6 +353,7 @@ const processSend = async (skipContactEmailCheck = false, skipMissingTagsCheck =
|
||||
.map((e) => e.trim())
|
||||
.includes(contactEmail)
|
||||
) {
|
||||
deferredStatus.value = statusToSet
|
||||
showContactEmailWarning.value = true
|
||||
return
|
||||
}
|
||||
@@ -464,23 +464,13 @@ const processSend = async (skipContactEmailCheck = false, skipMissingTagsCheck =
|
||||
clearMediaFiles()
|
||||
emailErrors.value = []
|
||||
mentions.value = []
|
||||
if (statusToSet) conversationStore.updateStatus(statusToSet)
|
||||
}
|
||||
isSending.value = false
|
||||
|
||||
// Return whether the message was sent successfully.
|
||||
return !hasMessageSendingErrored
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the send action and update conversation status.
|
||||
* The status is only updated if the message is sent successfully.
|
||||
*/
|
||||
const processSendAndSetStatus = async (status) => {
|
||||
const success = await processSend()
|
||||
if (success) {
|
||||
conversationStore.updateStatus(status)
|
||||
}
|
||||
}
|
||||
const processSendAndSetStatus = (status) => processSend(false, false, status)
|
||||
|
||||
/**
|
||||
* Watches for changes in the conversation's macro id and update message content.
|
||||
|
||||
@@ -40,7 +40,7 @@ export const useConversationStore = defineStore('conversation', () => {
|
||||
return statuses.value.map(s => ({ label: s.name, value: s.id }))
|
||||
})
|
||||
const statusOptionsNoSnooze = computed(() =>
|
||||
statuses.value.filter(s => s.name !== 'Snoozed').map(s => ({
|
||||
statuses.value.filter(s => s.name !== CONVERSATION_DEFAULT_STATUSES.SNOOZED).map(s => ({
|
||||
label: s.name,
|
||||
value: s.id
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user