Moves conversation.getProps out of models

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Josh Perez 2023-06-02 13:54:36 -04:00 committed by GitHub
parent a0d7c36e3b
commit 7c1957c30d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 810 additions and 598 deletions

View file

@ -0,0 +1,25 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ConversationAttributesType } from '../model-types.d';
import { SignalService as Proto } from '../protobuf';
import { isGroupV2 } from './whatTypeOfConversation';
import { areWeAdmin } from './areWeAdmin';
export function canAddNewMembers(
conversationAttrs: ConversationAttributesType
): boolean {
if (!isGroupV2(conversationAttrs)) {
return false;
}
if (conversationAttrs.left) {
return false;
}
return (
areWeAdmin(conversationAttrs) ||
conversationAttrs.accessControl?.members ===
Proto.AccessControl.AccessRequired.MEMBER
);
}