signal-desktop/ts/util/shouldBlurAvatar.ts
2021-10-26 14:15:33 -05:00

28 lines
615 B
TypeScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ConversationType } from '../state/ducks/conversations';
export const shouldBlurAvatar = ({
acceptedMessageRequest,
avatarPath,
isMe,
sharedGroupNames,
unblurredAvatarPath,
}: Readonly<
Pick<
ConversationType,
| 'acceptedMessageRequest'
| 'avatarPath'
| 'isMe'
| 'sharedGroupNames'
| 'unblurredAvatarPath'
>
>): boolean =>
Boolean(
!isMe &&
!acceptedMessageRequest &&
!sharedGroupNames.length &&
avatarPath &&
avatarPath !== unblurredAvatarPath
);