File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
package/src/components/MessageList Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -535,8 +535,12 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
535535
536536 const handleEvent = async ( event : Event ) => {
537537 const mainChannelUpdated = ! event . message ?. parent_id || event . message ?. show_in_channel ;
538- // When the scrollToBottomButtonVisible is true, we need to manually update the channelUnreadState.
539- if ( scrollToBottomButtonVisible || channelUnreadState ?. first_unread_message_id ) {
538+ const isMyOwnMessage = event . message ?. user ?. id === client . user ?. id ;
539+ // When the scrollToBottomButtonVisible is true, we need to manually update the channelUnreadState when its a received message.
540+ if (
541+ ( scrollToBottomButtonVisible || channelUnreadState ?. first_unread_message_id ) &&
542+ ! isMyOwnMessage
543+ ) {
540544 setChannelUnreadState ( ( prev ) => {
541545 const previousUnreadCount = prev ?. unread_messages ?? 0 ;
542546 const previousLastMessage = getPreviousLastMessage ( channel . state . messages , event . message ) ;
@@ -749,12 +753,10 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
749753 const isLastReadMessage =
750754 channelUnreadState ?. last_read_message_id === message . id ||
751755 ( ! channelUnreadState ?. unread_messages && createdAtTimestamp === lastReadTimestamp ) ;
752- const isMyMessage = message . user ?. id === client . userID ;
753756
754757 const showUnreadSeparator =
755758 isLastReadMessage &&
756759 ! isNewestMessage &&
757- ! isMyMessage &&
758760 // The `channelUnreadState?.first_unread_message_id` is here for sent messages unread label
759761 ( ! ! channelUnreadState ?. first_unread_message_id || ! ! channelUnreadState ?. unread_messages ) ;
760762
You can’t perform that action at this time.
0 commit comments