From 721a875c4468921dd2eb67c9298c6feb4bd6a73c Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 30 Jan 2025 11:31:14 +1000 Subject: [PATCH] modifyGroupV2: useCredentialsFrom only when profileKeyCredential needed --- ts/models/conversations.ts | 17 +++-------------- ts/state/ducks/conversations.ts | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index e15701e88f..a90bbb27e8 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -620,16 +620,7 @@ export class ConversationModel extends window.Backbone const idLog = this.idForLogging(); // Hard-coded to our own ID, because you don't add other users for admin approval - const conversationId = - window.ConversationController.getOurConversationIdOrThrow(); - - const toRequest = window.ConversationController.get(conversationId); - if (!toRequest) { - throw new Error( - `addPendingApprovalRequest/${idLog}: No conversation found for conversation ${conversationId}` - ); - } - + const toRequest = window.ConversationController.getOurConversationOrThrow(); const serviceId = toRequest.getCheckedServiceId( `addPendingApprovalRequest/${idLog}` ); @@ -2658,8 +2649,6 @@ export class ConversationModel extends window.Backbone const ourAci = window.textsecure.storage.user.getCheckedAci(); const ourPni = window.textsecure.storage.user.getPni(); - const ourConversation = - window.ConversationController.getOurConversationOrThrow(); if (this.isMemberPending(ourAci)) { await this.modifyGroupV2({ @@ -2670,7 +2659,7 @@ export class ConversationModel extends window.Backbone } else if (this.isMember(ourAci)) { await this.modifyGroupV2({ name: 'delete', - usingCredentialsFrom: [ourConversation], + usingCredentialsFrom: [], createGroupChange: () => this.#removeMember(ourAci), }); // Keep PNI in pending if ACI was a member. @@ -2749,7 +2738,7 @@ export class ConversationModel extends window.Backbone await this.modifyGroupV2({ name: 'toggleAdmin', - usingCredentialsFrom: [member], + usingCredentialsFrom: [], createGroupChange: () => this.#toggleAdminChange(serviceId), }); } diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index be1c432da6..53b94954a5 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -3473,7 +3473,7 @@ function approvePendingMembershipFromGroupV2( ); await modifyGroupV2({ conversation, - usingCredentialsFrom: [pendingMember], + usingCredentialsFrom: [], createGroupChange: async () => { // This user's pending state may have changed in the time between the user's // button press and when we get here. It's especially important to check here