From 6cd215dc6380e76c89d9d2fb57a916f56f7d336a Mon Sep 17 00:00:00 2001 From: canove Date: Wed, 7 Oct 2020 06:45:48 -0300 Subject: [PATCH] fix: block adding attachment on closed ticket (CTRL + V) --- frontend/src/components/MessageInput/index.js | 4 +++- frontend/src/components/Ticket/index.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/MessageInput/index.js b/frontend/src/components/MessageInput/index.js index 04e1ac4..07731a5 100644 --- a/frontend/src/components/MessageInput/index.js +++ b/frontend/src/components/MessageInput/index.js @@ -328,7 +328,9 @@ const MessageInput = ({ ticketStatus }) => { value={inputMessage} onChange={handleChangeInput} disabled={recording || loading || ticketStatus !== "open"} - onPaste={handleInputPaste} + onPaste={e => { + ticketStatus === "open" && handleInputPaste(); + }} onKeyPress={e => { if (loading || e.shiftKey) return; else if (e.key === "Enter") { diff --git a/frontend/src/components/Ticket/index.js b/frontend/src/components/Ticket/index.js index a6f37d7..1396f14 100644 --- a/frontend/src/components/Ticket/index.js +++ b/frontend/src/components/Ticket/index.js @@ -385,6 +385,14 @@ const Ticket = () => { }; }, [ticketId, history]); + const handleDrawerOpen = () => { + setDrawerOpen(true); + }; + + const handleDrawerClose = () => { + setDrawerOpen(false); + }; + const handleOpenMessageOptionsMenu = (e, messageId) => { setAnchorEl(e.currentTarget); setSelectedMessageId(messageId); @@ -471,14 +479,6 @@ const Ticket = () => { } }; - const handleDrawerOpen = () => { - setDrawerOpen(true); - }; - - const handleDrawerClose = () => { - setDrawerOpen(false); - }; - const renderMessageAck = message => { if (message.ack === 0) { return ;