Skip to content

Commit

Permalink
Fix hasUnseen-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
rottabonus committed May 26, 2024
1 parent 649426b commit 0f09b56
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/state/reducers/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<State>;
Expand Down Expand Up @@ -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) =>
Expand Down

0 comments on commit 0f09b56

Please sign in to comment.