From a5d2476cdbee8a68bfb194ef33d95f5396290622 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sat, 25 Jul 2020 09:18:53 -0500 Subject: [PATCH] fix: no pending for rejects --- src/client/chat--submitMessage.jsx | 1 - src/client/store/effects.js | 2 +- src/common/state/chat.js | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/chat--submitMessage.jsx b/src/client/chat--submitMessage.jsx index b845722..019fe53 100644 --- a/src/client/chat--submitMessage.jsx +++ b/src/client/chat--submitMessage.jsx @@ -29,7 +29,6 @@ export default function ChatSubmitMessage() { channel, message: chunk, owner: '/r/anonymous' === channel ? 0 : user.id, - pending: true, timestamp: Date.now(), uuid: uuidv4(), })); diff --git a/src/client/store/effects.js b/src/client/store/effects.js index a2f975a..6e491ae 100644 --- a/src/client/store/effects.js +++ b/src/client/store/effects.js @@ -108,7 +108,7 @@ const effects = { socket.send(new Leave(payload), () => dispatch(leave({channel}))); }, [submitMessage]: async ({dispatch}, {payload}) => { - dispatch(addMessage(payload)); + dispatch(addMessage({...payload, pending: true})); const reject = (ttr) => { dispatch(rejectMessage(payload.uuid)); dispatch(addMessage({ diff --git a/src/common/state/chat.js b/src/common/state/chat.js index 2844bfb..73bea02 100644 --- a/src/common/state/chat.js +++ b/src/common/state/chat.js @@ -76,6 +76,7 @@ const slice = createSlice({ users.splice(users.indexOf(id), 1); }, rejectMessage: ({messages}, {payload: uuid}) => { + delete messages[uuid].pending; messages[uuid].rejected = true; }, removeMessage: (state, {payload: {channel, uuid}}) => {