fix: add name property to GroupPromoteMessage

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

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

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

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

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

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

Loading…
Cancel
Save