signal-desktop/ts/util/shouldBlurAvatar.ts

29 lines
610 B
TypeScript
Raw Normal View History

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