Switch to the /v2/ storage-service endpoints for group operations
This commit is contained in:
parent
711f7d3352
commit
408444352f
6 changed files with 68 additions and 36 deletions
16
ts/groups.ts
16
ts/groups.ts
|
@ -1446,7 +1446,7 @@ async function uploadGroupChange({
|
|||
actions: Proto.GroupChange.IActions;
|
||||
group: ConversationAttributesType;
|
||||
inviteLinkPassword?: string;
|
||||
}): Promise<Proto.IGroupChange> {
|
||||
}): Promise<Proto.IGroupChangeResponse> {
|
||||
const logId = idForLogging(group.groupId);
|
||||
|
||||
// Ensure we have the credentials we need before attempting GroupsV2 operations
|
||||
|
@ -1552,11 +1552,13 @@ export async function modifyGroupV2({
|
|||
}
|
||||
|
||||
// Upload. If we don't have permission, the server will return an error here.
|
||||
const groupChange = await uploadGroupChange({
|
||||
const groupChangeResponse = await uploadGroupChange({
|
||||
actions,
|
||||
inviteLinkPassword,
|
||||
group: conversation.attributes,
|
||||
});
|
||||
const { groupChange } = groupChangeResponse;
|
||||
strictAssert(groupChange, 'missing groupChange');
|
||||
|
||||
const groupChangeBuffer =
|
||||
Proto.GroupChange.encode(groupChange).finish();
|
||||
|
@ -2738,12 +2740,13 @@ export async function respondToGroupV2Migration({
|
|||
`respondToGroupV2Migration/${logId}: Failed to access log endpoint; fetching full group state`
|
||||
);
|
||||
try {
|
||||
firstGroupState = await makeRequestWithCredentials({
|
||||
const groupResponse = await makeRequestWithCredentials({
|
||||
logId: `getGroup/${logId}`,
|
||||
publicParams,
|
||||
secretParams,
|
||||
request: (sender, options) => sender.getGroup(options),
|
||||
});
|
||||
firstGroupState = groupResponse.group;
|
||||
} catch (secondError) {
|
||||
if (secondError.code === GROUP_ACCESS_DENIED_CODE) {
|
||||
log.info(
|
||||
|
@ -3652,13 +3655,16 @@ async function updateGroupViaState({
|
|||
throw new Error('updateGroupViaState: group was missing publicParams!');
|
||||
}
|
||||
|
||||
const groupState = await makeRequestWithCredentials({
|
||||
const groupResponse = await makeRequestWithCredentials({
|
||||
logId: `getGroup/${logId}`,
|
||||
publicParams,
|
||||
secretParams,
|
||||
request: (sender, requestOptions) => sender.getGroup(requestOptions),
|
||||
});
|
||||
|
||||
const groupState = groupResponse.group;
|
||||
strictAssert(groupState, 'Group state must be present');
|
||||
|
||||
const decryptedGroupState = decryptGroupState(
|
||||
groupState,
|
||||
secretParams,
|
||||
|
@ -3792,7 +3798,7 @@ async function updateGroupViaLogs({
|
|||
// `integrateGroupChanges`.
|
||||
let revisionToFetch = isNumber(currentRevision) ? currentRevision : undefined;
|
||||
|
||||
let response;
|
||||
let response: GroupLogResponseType;
|
||||
const changes: Array<Proto.IGroupChanges> = [];
|
||||
do {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue