From 0f09b56a673353c0bc0550d4ae40f6e7214ee339 Mon Sep 17 00:00:00 2001 From: Felix Hallenberg Date: Sun, 26 May 2024 10:05:28 +0300 Subject: [PATCH] Fix hasUnseen-selector --- src/state/reducers/messages.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/state/reducers/messages.ts b/src/state/reducers/messages.ts index 9c649b91..44ad5364 100644 --- a/src/state/reducers/messages.ts +++ b/src/state/reducers/messages.ts @@ -16,7 +16,7 @@ import * as actions from '../actions'; import * as types from '../types'; import { withToken } from './accessToken'; -import { getBuddyStatus } from '../selectors'; +import { getBuddyStatus, getIsBanned } from '../selectors'; export type State = types.AppState['messages']; export type LoopState = actions.LS; @@ -237,7 +237,10 @@ export const hasUnseen: ( buddyId: string, ) => (appState: types.AppState) => boolean = buddyId => appState => pipe(getMessagesByBuddyId(buddyId)(appState), messages => - messages.some(({ type, isSeen }) => type === 'Received' && !isSeen), + messages.some( + ({ type, isSeen }) => + type === 'Received' && !isSeen && !getIsBanned(buddyId)(appState), + ), ); export const isAnyMessageUnseen = (appState: types.AppState) =>