Group name spoofing warning
This commit is contained in:
parent
51b45ab275
commit
36c15fead4
20 changed files with 1312 additions and 215 deletions
22
ts/util/isConversationNameKnown.ts
Normal file
22
ts/util/isConversationNameKnown.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { ConversationType } from '../state/ducks/conversations';
|
||||
import { missingCaseError } from './missingCaseError';
|
||||
|
||||
export function isConversationNameKnown(
|
||||
conversation: Readonly<
|
||||
Pick<ConversationType, 'e164' | 'name' | 'profileName' | 'type'>
|
||||
>
|
||||
): boolean {
|
||||
switch (conversation.type) {
|
||||
case 'direct':
|
||||
return Boolean(
|
||||
conversation.name || conversation.profileName || conversation.e164
|
||||
);
|
||||
case 'group':
|
||||
return Boolean(conversation.name);
|
||||
default:
|
||||
throw missingCaseError(conversation.type);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue