Merge branch 'chats-dupe' into 'develop'
Chats: fix #451 duplicated message Closes #451 See merge request soapbox-pub/soapbox-fe!279
This commit is contained in:
commit
5e1d3421cf
2 changed files with 4 additions and 4 deletions
|
@ -57,11 +57,13 @@ export function connectTimelineStream(timelineId, path, pollingRefresh = null, a
|
||||||
case 'pleroma:chat_update':
|
case 'pleroma:chat_update':
|
||||||
dispatch((dispatch, getState) => {
|
dispatch((dispatch, getState) => {
|
||||||
const chat = JSON.parse(data.payload);
|
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({
|
dispatch({
|
||||||
type: STREAMING_CHAT_UPDATE,
|
type: STREAMING_CHAT_UPDATE,
|
||||||
chat,
|
chat,
|
||||||
|
me,
|
||||||
// Only play sounds for recipient messages
|
// Only play sounds for recipient messages
|
||||||
meta: !messageOwned && getSettings(getState()).getIn(['chats', 'sound']) && { sound: 'chat' },
|
meta: !messageOwned && getSettings(getState()).getIn(['chats', 'sound']) && { sound: 'chat' },
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,9 +39,7 @@ const importLastMessages = (state, chats) =>
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const replaceMessage = (state, chatId, oldId, newId) => {
|
const replaceMessage = (state, chatId, oldId, newId) => {
|
||||||
const ids = state.get(chatId, ImmutableOrderedSet());
|
return state.update(chatId, chat => chat.delete(oldId).add(newId).sort(idComparator));
|
||||||
const newIds = ids.delete(oldId).add(newId).sort(idComparator);
|
|
||||||
return state.set(chatId, newIds);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function chatMessageLists(state = initialState, action) {
|
export default function chatMessageLists(state = initialState, action) {
|
||||||
|
|
Loading…
Reference in a new issue