@@ -36,6 +36,10 @@ import {
3636 MessagesContextValue ,
3737 useMessagesContext ,
3838} from '../../contexts/messagesContext/MessagesContext' ;
39+ import {
40+ OwnCapabilitiesContextValue ,
41+ useOwnCapabilitiesContext ,
42+ } from '../../contexts/ownCapabilitiesContext/OwnCapabilitiesContext' ;
3943import {
4044 PaginatedMessageListContextValue ,
4145 usePaginatedMessageListContext ,
@@ -93,6 +97,7 @@ type MessageFlashListPropsWithContext = Pick<
9397 AttachmentPickerContextValue ,
9498 'closePicker' | 'selectedPicker' | 'setSelectedPicker'
9599> &
100+ Pick < OwnCapabilitiesContextValue , 'readEvents' > &
96101 Pick <
97102 ChannelContextValue ,
98103 | 'channel'
@@ -269,6 +274,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
269274 Message,
270275 MessageSystem,
271276 myMessageTheme,
277+ readEvents,
272278 NetworkDownIndicator,
273279 noGroupByUser,
274280 onListScroll,
@@ -630,7 +636,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
630636 * This function should show or hide the unread indicator depending on the
631637 */
632638 const updateStickyUnreadIndicator = useStableCallback ( ( viewableItems : ViewToken [ ] ) => {
633- if ( ! viewableItems . length ) {
639+ if ( ! viewableItems . length || ! readEvents ) {
634640 setIsUnreadNotificationOpen ( false ) ;
635641 return ;
636642 }
@@ -1227,6 +1233,7 @@ export const MessageFlashList = (props: MessageFlashListProps) => {
12271233 } = useMessagesContext ( ) ;
12281234 const { loadMore, loadMoreRecent } = usePaginatedMessageListContext ( ) ;
12291235 const { loadMoreRecentThread, loadMoreThread, thread, threadInstance } = useThreadContext ( ) ;
1236+ const { readEvents } = useOwnCapabilitiesContext ( ) ;
12301237
12311238 return (
12321239 < MessageFlashListWithContext
@@ -1260,6 +1267,7 @@ export const MessageFlashList = (props: MessageFlashListProps) => {
12601267 MessageSystem,
12611268 myMessageTheme,
12621269 NetworkDownIndicator,
1270+ readEvents,
12631271 reloadChannel,
12641272 ScrollToBottomButton,
12651273 scrollToFirstUnreadThreshold,
0 commit comments