signal-desktop/ts/util/shouldBlurAvatar.ts
2024-07-11 12:44:09 -07:00

28 lines
608 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,
avatarUrl,
isMe,
sharedGroupNames,
unblurredAvatarUrl,
}: Readonly<
Pick<
ConversationType,
| 'acceptedMessageRequest'
| 'avatarUrl'
| 'isMe'
| 'sharedGroupNames'
| 'unblurredAvatarUrl'
>
>): boolean =>
Boolean(
!isMe &&
!acceptedMessageRequest &&
!sharedGroupNames.length &&
avatarUrl &&
avatarUrl !== unblurredAvatarUrl
);