You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/session/utils/Groups.ts

25 lines
634 B
TypeScript

import { PubKey } from '../types';
export async function getGroupMembers(groupId: PubKey): Promise<Array<PubKey>> {
const groupConversation = window.ConversationController.get(groupId.key);
const groupMembers = groupConversation
? groupConversation.attributes.members
: undefined;
if (!groupMembers) {
return [];
}
return groupMembers.map((member: string) => new PubKey(member));
}
export function isMediumGroup(groupId: PubKey): boolean {
const conversation = window.ConversationController.get(groupId.key);
if (!conversation) {
return false;
}
return Boolean(conversation.isMediumGroup());
}