From 7722ce5e687a1153009248c05b0cb6eecce65f59 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 29 Sep 2022 10:58:58 -0500 Subject: [PATCH] Chats: don't update own messages from streaming (for now) --- app/soapbox/actions/streaming.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/soapbox/actions/streaming.ts b/app/soapbox/actions/streaming.ts index b6b8ac0bc5..9e99b0d2f0 100644 --- a/app/soapbox/actions/streaming.ts +++ b/app/soapbox/actions/streaming.ts @@ -109,8 +109,17 @@ const connectTimelineStream = ( break; case 'pleroma:chat_update': case 'chat_message': // TruthSocial - updateChat(JSON.parse(data.payload)); - play(soundCache.chat); + dispatch((dispatch: AppDispatch, getState: () => RootState) => { + const chat = JSON.parse(data.payload); + const me = getState().me; + const messageOwned = chat.last_message?.account_id === me; + + // Don't update own messages from streaming + if (!messageOwned) { + updateChat(chat); + play(soundCache.chat); + } + }); break; case 'pleroma:follow_relationships_update': dispatch(updateFollowRelationships(JSON.parse(data.payload)));