fix: explicitly set expirationType to undefined if sending a legacy message

pull/2660/head
William Grant 2 years ago
parent bddc018ce7
commit b8ab952c33

@ -1190,6 +1190,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
}
if (this.isPrivate()) {
// debugger;
const expirationTimerMessage = new ExpirationTimerUpdateMessage(expireUpdate);
const pubkey = new PubKey(this.get('id'));
await getMessageQueue().sendToPubKey(pubkey, expirationTimerMessage);

@ -409,8 +409,7 @@ export async function innerHandleSwarmContentMessage(
dataMessage.profileKey = null;
}
perfStart(`handleSwarmDataMessage-${envelope.id}`);
// debugger;
// TODO legacy messages support will be removed in a future release
// We will only support legacy disappearing messages for a short period before disappearing messages v2 is unlocked
const isDisappearingMessagesV2Released = await checkIsFeatureReleased(
@ -477,6 +476,7 @@ export async function innerHandleSwarmContentMessage(
}
}
perfStart(`handleSwarmDataMessage-${envelope.id}`);
await handleSwarmDataMessage(
envelope,
sentAtTimestamp,

@ -14,8 +14,12 @@ export class ExpirableMessage extends ContentMessage {
public readonly expireTimer?: number;
constructor(params: ExpirableMessageParams) {
super({ timestamp: params.timestamp, identifier: params.identifier });
this.expirationType = params.expirationType;
super({
timestamp: params.timestamp,
identifier: params.identifier,
});
// TODO legacy messages support will be removed in a future release
this.expirationType = params.expirationType !== 'legacy' ? params.expirationType : undefined;
this.expireTimer = params.expireTimer;
}
@ -31,6 +35,13 @@ export class ExpirableMessage extends ContentMessage {
});
}
public dataProto(): SignalService.DataMessage {
return new SignalService.DataMessage({
// TODO legacy messages support will be removed in a future release
expireTimer: !this.expirationType && this.expireTimer ? this.expireTimer : undefined,
});
}
public getDisappearingMessageType(): DisappearingMessageType | undefined {
return this.expirationType;
}

@ -63,11 +63,6 @@ export class ExpirationTimerUpdateMessage extends DataMessage {
data.syncTarget = this.syncTarget;
}
// TODO legacy messages support will be removed in a future release
if (this.expirationType === 'legacy' && this.expireTimer) {
data.expireTimer = this.expireTimer;
}
return data;
}
}

@ -44,11 +44,6 @@ export abstract class ClosedGroupMessage extends ExpirableMessage {
dataMessage.closedGroupControlMessage = new SignalService.DataMessage.ClosedGroupControlMessage();
// TODO legacy messages support will be removed in a future release
if (this.expirationType === 'legacy' && this.expireTimer) {
dataMessage.expireTimer = this.expireTimer;
}
return dataMessage;
}
}

@ -181,11 +181,6 @@ export class VisibleMessage extends ExpirableMessage {
dataMessage.timestamp = this.timestamp;
// TODO legacy messages support will be removed in a future release
if (this.expirationType === 'legacy' && this.expireTimer) {
dataMessage.expireTimer = this.expireTimer;
}
return dataMessage;
}

Loading…
Cancel
Save