signal-desktop/ts/util/shouldBlurAvatar.ts

29 lines
608 B
TypeScript
Raw Normal View History

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ConversationType } from '../state/ducks/conversations';
export const shouldBlurAvatar = ({
acceptedMessageRequest,
2024-07-11 19:44:09 +00:00
avatarUrl,
isMe,
2021-05-07 22:21:10 +00:00
sharedGroupNames,
2024-07-11 19:44:09 +00:00
unblurredAvatarUrl,
}: Readonly<
Pick<
ConversationType,
| 'acceptedMessageRequest'
2024-07-11 19:44:09 +00:00
| 'avatarUrl'
| 'isMe'
| 'sharedGroupNames'
2024-07-11 19:44:09 +00:00
| 'unblurredAvatarUrl'
>
>): boolean =>
Boolean(
!isMe &&
!acceptedMessageRequest &&
!sharedGroupNames.length &&
2024-07-11 19:44:09 +00:00
avatarUrl &&
avatarUrl !== unblurredAvatarUrl
);