Implemented ability to quickly add a user to a group

This commit is contained in:
Alvaro 2022-09-26 10:24:52 -06:00 committed by GitHub
parent 190cd9408b
commit 22bf3ebcc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 855 additions and 70 deletions

View file

@ -130,6 +130,7 @@ export type ConversationType = {
areWePendingApproval?: boolean;
canChangeTimer?: boolean;
canEditGroupInfo?: boolean;
canAddNewMembers?: boolean;
color?: AvatarColorType;
conversationColor?: ConversationColorType;
customColor?: CustomColorType;
@ -803,6 +804,7 @@ export type ConversationActionType =
// Action Creators
export const actions = {
addMemberToGroup,
cancelConversationVerification,
changeHasGroupLink,
clearCancelledConversationVerification,
@ -2004,6 +2006,25 @@ function removeMemberFromGroup(
};
}
function addMemberToGroup(
conversationId: string,
contactId: string,
onComplete: () => void
): ThunkAction<void, RootStateType, unknown, never> {
return async () => {
const conversationModel = window.ConversationController.get(conversationId);
if (conversationModel) {
const idForLogging = conversationModel.idForLogging();
await longRunningTaskWrapper({
name: 'addMemberToGroup',
idForLogging,
task: () => conversationModel.addMembersV2([contactId]),
});
onComplete();
}
};
}
function toggleGroupsForStorySend(
conversationIds: Array<string>
): ThunkAction<void, RootStateType, unknown, NoopActionType> {