fix: add name property to GroupPromoteMessage

pull/3052/head
Audric Ackermann 9 months ago
parent 79aca9c231
commit 4d7a0e7a04

@ -115,6 +115,7 @@ message GroupUpdateMemberChangeMessage {
message GroupUpdatePromoteMessage {
required bytes groupIdentitySeed = 1;
required string name = 2;
}
message GroupUpdateMemberLeftMessage {

@ -73,7 +73,7 @@ async function sendInviteResponseToGroup({ groupPk }: { groupPk: GroupPubkeyType
});
}
async function handleGroupInviteMessage({
async function handleGroupUpdateInviteMessage({
inviteMessage,
author,
signatureTimestamp,
@ -555,7 +555,7 @@ async function handle1o1GroupUpdateMessage(
throw new PreConditionFailed('received group invite/promote with invalid author');
}
if (details.updateMessage.inviteMessage) {
await handleGroupInviteMessage({
await handleGroupUpdateInviteMessage({
inviteMessage: details.updateMessage
.inviteMessage as SignalService.GroupUpdateInviteMessage,
...details,

@ -61,10 +61,12 @@ async function getGroupPromoteMessage({
member,
secretKey,
groupPk,
name,
}: {
member: PubkeyType;
secretKey: Uint8ArrayLen64; // len 64
groupPk: GroupPubkeyType;
name: string;
}) {
const createAtNetworkTimestamp = GetNetworkTime.now();
@ -78,6 +80,7 @@ async function getGroupPromoteMessage({
groupIdentitySeed: secretKey.slice(0, 32), // the seed is the first 32 bytes of the secretkey
expirationType: 'unknown', // a promote message is not expiring
expireTimer: 0,
name,
});
return msg;
}

@ -5,6 +5,7 @@ import { GroupUpdateMessage, GroupUpdateMessageParams } from '../GroupUpdateMess
interface Params extends GroupUpdateMessageParams {
groupPk: GroupPubkeyType;
groupIdentitySeed: Uint8Array;
name: string;
}
/**
@ -12,19 +13,25 @@ interface Params extends GroupUpdateMessageParams {
*/
export class GroupUpdatePromoteMessage extends GroupUpdateMessage {
public readonly groupIdentitySeed: Params['groupIdentitySeed'];
public readonly name: Params['name'];
constructor(params: Params) {
super(params);
this.groupIdentitySeed = params.groupIdentitySeed;
this.name = params.name;
if (!this.groupIdentitySeed || this.groupIdentitySeed.length !== 32) {
throw new Error('groupIdentitySeed must be set');
}
if (!this.name) {
throw new Error('name must be set and not empty');
}
}
public dataProto(): SignalService.DataMessage {
const promoteMessage = new SignalService.GroupUpdatePromoteMessage({
groupIdentitySeed: this.groupIdentitySeed,
name: this.name,
});
return new SignalService.DataMessage({

@ -102,6 +102,7 @@ class GroupPromoteJob extends PersistedJob<GroupPromotePersistedData> {
member,
secretKey: group.secretKey,
groupPk,
name: group.name,
});
const storedAt = await getMessageQueue().sendTo1o1NonDurably({

Loading…
Cancel
Save