Files
Desktop/ts/util/canAddNewMembers.preload.ts
Fedor Indutny 44076ece79 Rename files
2025-10-16 23:45:44 -07:00

26 lines
701 B
TypeScript

// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ConversationAttributesType } from '../model-types.d.ts';
import { SignalService as Proto } from '../protobuf/index.std.js';
import { isGroupV2 } from './whatTypeOfConversation.dom.js';
import { areWeAdmin } from './areWeAdmin.preload.js';
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
);
}