Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion package/src/components/MessageList/MessageFlashList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import {
MessagesContextValue,
useMessagesContext,
} from '../../contexts/messagesContext/MessagesContext';
import {
OwnCapabilitiesContextValue,
useOwnCapabilitiesContext,
} from '../../contexts/ownCapabilitiesContext/OwnCapabilitiesContext';
import {
PaginatedMessageListContextValue,
usePaginatedMessageListContext,
Expand Down Expand Up @@ -93,6 +97,7 @@ type MessageFlashListPropsWithContext = Pick<
AttachmentPickerContextValue,
'closePicker' | 'selectedPicker' | 'setSelectedPicker'
> &
Pick<OwnCapabilitiesContextValue, 'readEvents'> &
Pick<
ChannelContextValue,
| 'channel'
Expand Down Expand Up @@ -269,6 +274,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
Message,
MessageSystem,
myMessageTheme,
readEvents,
NetworkDownIndicator,
noGroupByUser,
onListScroll,
Expand Down Expand Up @@ -630,7 +636,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
* This function should show or hide the unread indicator depending on the
*/
const updateStickyUnreadIndicator = useStableCallback((viewableItems: ViewToken[]) => {
if (!viewableItems.length) {
if (!viewableItems.length || !readEvents) {
setIsUnreadNotificationOpen(false);
return;
}
Expand Down Expand Up @@ -1227,6 +1233,7 @@ export const MessageFlashList = (props: MessageFlashListProps) => {
} = useMessagesContext();
const { loadMore, loadMoreRecent } = usePaginatedMessageListContext();
const { loadMoreRecentThread, loadMoreThread, thread, threadInstance } = useThreadContext();
const { readEvents } = useOwnCapabilitiesContext();

return (
<MessageFlashListWithContext
Expand Down Expand Up @@ -1260,6 +1267,7 @@ export const MessageFlashList = (props: MessageFlashListProps) => {
MessageSystem,
myMessageTheme,
NetworkDownIndicator,
readEvents,
reloadChannel,
ScrollToBottomButton,
scrollToFirstUnreadThreshold,
Expand Down
10 changes: 9 additions & 1 deletion package/src/components/MessageList/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ import {
MessagesContextValue,
useMessagesContext,
} from '../../contexts/messagesContext/MessagesContext';
import {
OwnCapabilitiesContextValue,
useOwnCapabilitiesContext,
} from '../../contexts/ownCapabilitiesContext/OwnCapabilitiesContext';
import {
PaginatedMessageListContextValue,
usePaginatedMessageListContext,
Expand Down Expand Up @@ -115,6 +119,7 @@ type MessageListPropsWithContext = Pick<
AttachmentPickerContextValue,
'closePicker' | 'selectedPicker' | 'setSelectedPicker'
> &
Pick<OwnCapabilitiesContextValue, 'readEvents'> &
Pick<
ChannelContextValue,
| 'channel'
Expand Down Expand Up @@ -277,6 +282,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
noGroupByUser,
onListScroll,
onThreadSelect,
readEvents,
reloadChannel,
ScrollToBottomButton,
selectedPicker,
Expand Down Expand Up @@ -441,7 +447,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
}
messagesLength.current = processedMessageList.length;

if (!viewableItems.length) {
if (!viewableItems.length || !readEvents) {
setIsUnreadNotificationOpen(false);
return;
}
Expand Down Expand Up @@ -1294,6 +1300,7 @@ export const MessageList = (props: MessageListProps) => {
} = useChannelContext();
const { client } = useChatContext();
const { setMessages } = useImageGalleryContext();
const { readEvents } = useOwnCapabilitiesContext();
const {
DateHeader,
disableTypingIndicator,
Expand Down Expand Up @@ -1345,6 +1352,7 @@ export const MessageList = (props: MessageListProps) => {
MessageSystem,
myMessageTheme,
NetworkDownIndicator,
readEvents,
reloadChannel,
ScrollToBottomButton,
scrollToFirstUnreadThreshold,
Expand Down