diff --git a/app/soapbox/actions/streaming.js b/app/soapbox/actions/streaming.js index b3ca60fb3..3b66a0472 100644 --- a/app/soapbox/actions/streaming.js +++ b/app/soapbox/actions/streaming.js @@ -57,11 +57,13 @@ export function connectTimelineStream(timelineId, path, pollingRefresh = null, a case 'pleroma:chat_update': dispatch((dispatch, getState) => { const chat = JSON.parse(data.payload); - const messageOwned = !(chat.last_message && chat.last_message.account_id !== getState().get('me')); + const me = getState().get('me'); + const messageOwned = !(chat.last_message && chat.last_message.account_id !== me); dispatch({ type: STREAMING_CHAT_UPDATE, chat, + me, // Only play sounds for recipient messages meta: !messageOwned && getSettings(getState()).getIn(['chats', 'sound']) && { sound: 'chat' }, }); diff --git a/app/soapbox/reducers/chat_message_lists.js b/app/soapbox/reducers/chat_message_lists.js index 8848a8389..3a7ec8610 100644 --- a/app/soapbox/reducers/chat_message_lists.js +++ b/app/soapbox/reducers/chat_message_lists.js @@ -39,9 +39,7 @@ const importLastMessages = (state, chats) => })); const replaceMessage = (state, chatId, oldId, newId) => { - const ids = state.get(chatId, ImmutableOrderedSet()); - const newIds = ids.delete(oldId).add(newId).sort(idComparator); - return state.set(chatId, newIds); + return state.update(chatId, chat => chat.delete(oldId).add(newId).sort(idComparator)); }; export default function chatMessageLists(state = initialState, action) {