fix: Cannot delete message with attachments without content (#6378)

This commit is contained in:
Sivin Varghese
2023-02-03 00:33:19 +05:30
committed by GitHub
parent c9667190f6
commit 84e46adf1c
2 changed files with 21 additions and 15 deletions

View File

@@ -105,7 +105,8 @@
v-if="isBubble && !isMessageDeleted" v-if="isBubble && !isMessageDeleted"
:is-open="showContextMenu" :is-open="showContextMenu"
:show-copy="hasText" :show-copy="hasText"
:show-canned-response-option="isOutgoing" :show-delete="hasTextOrAttachment"
:show-canned-response-option="isOutgoing && hasText"
:menu-position="contextMenuPosition" :menu-position="contextMenuPosition"
:message-content="data.content" :message-content="data.content"
@toggle="handleContextMenuClick" @toggle="handleContextMenuClick"
@@ -308,6 +309,9 @@ export default {
hasText() { hasText() {
return !!this.data.content; return !!this.data.content;
}, },
hasTextOrAttachment() {
return this.hasText || this.data.attachments.length > 0;
},
tooltipForSender() { tooltipForSender() {
const name = this.senderNameForAvatar; const name = this.senderNameForAvatar;
const { message_type: messageType } = this.data; const { message_type: messageType } = this.data;

View File

@@ -24,18 +24,18 @@
:class="`dropdown-pane--${menuPosition}`" :class="`dropdown-pane--${menuPosition}`"
> >
<woot-dropdown-menu> <woot-dropdown-menu>
<woot-dropdown-item v-if="showDelete">
<woot-button
variant="clear"
color-scheme="alert"
size="small"
icon="delete"
@click="handleDelete"
>
{{ $t('CONVERSATION.CONTEXT_MENU.DELETE') }}
</woot-button>
</woot-dropdown-item>
<woot-dropdown-item v-if="showCopy"> <woot-dropdown-item v-if="showCopy">
<woot-dropdown-item>
<woot-button
variant="clear"
color-scheme="alert"
size="small"
icon="delete"
@click="handleDelete"
>
{{ $t('CONVERSATION.CONTEXT_MENU.DELETE') }}
</woot-button>
</woot-dropdown-item>
<woot-button <woot-button
variant="clear" variant="clear"
size="small" size="small"
@@ -46,10 +46,8 @@
{{ $t('CONVERSATION.CONTEXT_MENU.COPY') }} {{ $t('CONVERSATION.CONTEXT_MENU.COPY') }}
</woot-button> </woot-button>
</woot-dropdown-item> </woot-dropdown-item>
<woot-dropdown-item v-if="showCannedResponseOption">
<woot-dropdown-item>
<woot-button <woot-button
v-if="showCannedResponseOption"
variant="clear" variant="clear"
size="small" size="small"
icon="comment-add" icon="comment-add"
@@ -94,6 +92,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
showDelete: {
type: Boolean,
default: false,
},
menuPosition: { menuPosition: {
type: String, type: String,
default: 'left', default: 'left',