sforkowany z mirror/soapbox
Merge branch 'chats-dupe' into 'develop'
Chats: fix #451 duplicated message Closes #451 See merge request soapbox-pub/soapbox-fe!279config-ui-updates
commit
5e1d3421cf
|
@ -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' },
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
Ładowanie…
Reference in New Issue