From 2e71006f9d399fea08721316aceeced8bfc629a7 Mon Sep 17 00:00:00 2001 From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Date: Tue, 29 Jun 2021 20:06:40 +0530 Subject: [PATCH] feat: Add option to delete message content (#2532) --- .../widgets/conversation/Message.vue | 92 +++++++++++++++++- .../i18n/locale/en/conversation.json | 6 ++ .../components/MessageContextMenu.vue | 93 +++++++++++++++++++ 3 files changed, 186 insertions(+), 5 deletions(-) create mode 100644 app/javascript/dashboard/modules/conversations/components/MessageContextMenu.vue diff --git a/app/javascript/dashboard/components/widgets/conversation/Message.vue b/app/javascript/dashboard/components/widgets/conversation/Message.vue index d5d6e9edf..6c319ee15 100644 --- a/app/javascript/dashboard/components/widgets/conversation/Message.vue +++ b/app/javascript/dashboard/components/widgets/conversation/Message.vue @@ -43,6 +43,16 @@ :source-id="data.source_id" /> + + @@ -294,4 +345,35 @@ export default { margin-left: var(--space-smaller); } } + +.button--delete-message { + visibility: hidden; +} + +.wrap { + display: flex; + align-items: flex-end; +} + +li.right .wrap { + flex-direction: row-reverse; +} + +li.left, +li.right { + &:hover .button--delete-message { + visibility: visible; + } +} + +.has-context-menu { + background: var(--color-background); + .button--delete-message { + visibility: visible; + } +} + +.context-menu { + position: relative; +} diff --git a/app/javascript/dashboard/i18n/locale/en/conversation.json b/app/javascript/dashboard/i18n/locale/en/conversation.json index 587530e74..133bdcaa2 100644 --- a/app/javascript/dashboard/i18n/locale/en/conversation.json +++ b/app/javascript/dashboard/i18n/locale/en/conversation.json @@ -27,6 +27,8 @@ "REMOVE_SELECTION": "Remove Selection", "DOWNLOAD": "Download", "UPLOADING_ATTACHMENTS": "Uploading attachments...", + "SUCCESS_DELETE_MESSAGE": "Message deleted successfully", + "FAIL_DELETE_MESSSAGE": "Couldn't delete message! Try again", "NO_RESPONSE": "No response", "RATING_TITLE": "Rating", "FEEDBACK_TITLE": "Feedback", @@ -66,6 +68,10 @@ "SELECT_AGENT": "Select Agent", "REMOVE": "Remove", "ASSIGN": "Assign" + }, + "CONTEXT_MENU": { + "COPY": "Copy", + "DELETE": "Delete" } }, "EMAIL_TRANSCRIPT": { diff --git a/app/javascript/dashboard/modules/conversations/components/MessageContextMenu.vue b/app/javascript/dashboard/modules/conversations/components/MessageContextMenu.vue new file mode 100644 index 000000000..9a7cd1d4c --- /dev/null +++ b/app/javascript/dashboard/modules/conversations/components/MessageContextMenu.vue @@ -0,0 +1,93 @@ + + +