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.
19 lines
585 B
TypeScript
19 lines
585 B
TypeScript
5 years ago
|
import { getAllConversations } from '../../../js/modules/data';
|
||
|
import { Whisper } from '../../window';
|
||
|
import { PubKey } from '../types';
|
||
|
|
||
|
export async function getGroupMembers(groupId: string): Promise<Array<PubKey>> {
|
||
|
const conversations = await getAllConversations({
|
||
|
ConversationCollection: Whisper.ConversationCollection,
|
||
|
});
|
||
|
const groupConversation = conversations.find(c => c.id === groupId);
|
||
|
|
||
|
const groupMembers = groupConversation.attributes.members;
|
||
|
|
||
|
if (!groupMembers) {
|
||
|
return [];
|
||
|
}
|
||
|
|
||
|
return groupMembers.map((member: string) => new PubKey(member));
|
||
|
}
|