fix: no pending for rejects

This commit is contained in:
cha0s 2020-07-25 09:18:53 -05:00
parent 4a802571f6
commit a5d2476cdb
3 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,6 @@ export default function ChatSubmitMessage() {
channel, channel,
message: chunk, message: chunk,
owner: '/r/anonymous' === channel ? 0 : user.id, owner: '/r/anonymous' === channel ? 0 : user.id,
pending: true,
timestamp: Date.now(), timestamp: Date.now(),
uuid: uuidv4(), uuid: uuidv4(),
})); }));

View File

@ -108,7 +108,7 @@ const effects = {
socket.send(new Leave(payload), () => dispatch(leave({channel}))); socket.send(new Leave(payload), () => dispatch(leave({channel})));
}, },
[submitMessage]: async ({dispatch}, {payload}) => { [submitMessage]: async ({dispatch}, {payload}) => {
dispatch(addMessage(payload)); dispatch(addMessage({...payload, pending: true}));
const reject = (ttr) => { const reject = (ttr) => {
dispatch(rejectMessage(payload.uuid)); dispatch(rejectMessage(payload.uuid));
dispatch(addMessage({ dispatch(addMessage({

View File

@ -76,6 +76,7 @@ const slice = createSlice({
users.splice(users.indexOf(id), 1); users.splice(users.indexOf(id), 1);
}, },
rejectMessage: ({messages}, {payload: uuid}) => { rejectMessage: ({messages}, {payload: uuid}) => {
delete messages[uuid].pending;
messages[uuid].rejected = true; messages[uuid].rejected = true;
}, },
removeMessage: (state, {payload: {channel, uuid}}) => { removeMessage: (state, {payload: {channel, uuid}}) => {