feat: make sure to use ms for the expireTimer

expireTimer on the model is in seconds so we need to convert it
pull/2971/head
William Grant 2 years ago
parent 7f68107738
commit 32b7870e07

@ -1179,7 +1179,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
if (messageHash) {
await expireMessageOnSnode({
messageHash,
expireTimer: this.get('expireTimer'),
expireTimer: this.get('expireTimer') * 1000,
shorten: true,
});
}

@ -25,9 +25,9 @@ export interface MessageAttributes {
reacts?: ReactionList;
reactsIndex?: number;
body?: string;
// NOTE this is used for the logic
expirationType?: DisappearingMessageType;
expireTimer: number; // in seconds, 0 means no expiration
/** in seconds, 0 means no expiration */
expireTimer: number;
expirationStartTimestamp: number;
expires_at?: number;
// NOTE this is used for conversation setting

@ -157,7 +157,7 @@ async function expireOnNodes(targetNode: Snode, expireRequest: UpdateExpiryOnNod
);
const firstExpirationResult = Object.entries(expirationResults).at(0);
window.log.debug(
`WIP: expireOnNodes attempt complete. Here are the results from one of the snodes.\nmessageHash: ${
`WIP: expireOnNodes succeeded! Here are the results from one of the snodes.\nmessageHash: ${
firstExpirationResult?.[0]
} \nexpires at: ${
firstExpirationResult?.[1]?.expiry
@ -252,7 +252,7 @@ async function buildExpireRequest(
* Sends an 'expire' request to the user's swarm for a specific message.
* This supports both extending and shortening a message's TTL.
* @param messageHash the hash of the message to expire
* @param expireTimer the new TTL for the message
* @param expireTimer amount of time until we expire the message from now in milliseconds
* @param extend whether to extend the message's TTL
* @param shorten whether to shorten the message's TTL
*/

Loading…
Cancel
Save