refactor: replaced get expirationStartTimestamp calls

with getExpirationStartTimestamp
pull/2971/head
William Grant 2 years ago
parent 777584945d
commit 61eccb8d0f

@ -299,7 +299,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
? this.getExpireTimer() * DURATION.SECONDS
: null;
const expireTimerStart = this.get('expirationStartTimestamp') || null;
const expireTimerStart = this.getExpirationStartTimestamp() || null;
const expirationTimestamp =
expirationType && expireTimerStart && expirationLength
@ -519,7 +519,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
const sender = this.getSource();
const expirationType = this.getExpirationType();
const expirationLength = this.getExpireTimer() * DURATION.SECONDS;
const expireTimerStart = this.get('expirationStartTimestamp');
const expireTimerStart = this.getExpirationStartTimestamp();
const expirationTimestamp =
expirationType && expireTimerStart && expirationLength
? expireTimerStart + expirationLength
@ -1137,7 +1137,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
}
public isExpiring() {
return this.getExpireTimer() && this.get('expirationStartTimestamp');
return this.getExpireTimer() && this.getExpirationStartTimestamp();
}
public isExpired() {
@ -1149,7 +1149,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
return Infinity;
}
const now = Date.now();
const start = this.get('expirationStartTimestamp');
const start = this.getExpirationStartTimestamp();
if (!start) {
return Infinity;
}
@ -1163,7 +1163,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
public async setToExpire() {
if (this.isExpiring() && !this.get('expires_at')) {
const start = this.get('expirationStartTimestamp');
const start = this.getExpirationStartTimestamp();
const delta = this.getExpireTimer() * 1000;
if (!start) {
return;

@ -345,7 +345,7 @@ async function markConvoAsReadIfOutgoingMessage(
if (
expirationType &&
expireTimer > 0 &&
Boolean(message.get('expirationStartTimestamp')) === false
Boolean(message.getExpirationStartTimestamp()) === false
) {
const expirationMode = changeToDisappearingConversationMode(
conversation,
@ -395,7 +395,7 @@ export async function handleMessageJob(
if (
conversation &&
messageModel.getExpireTimer() > 0 &&
Boolean(messageModel.get('expirationStartTimestamp')) === false
Boolean(messageModel.getExpirationStartTimestamp()) === false
) {
const expirationMode = changeToDisappearingConversationMode(
conversation,

@ -170,7 +170,7 @@ async function send(
expirationType &&
expireTimer > 0 &&
// a message has started to disappear
foundMessage.get('expirationStartTimestamp')
foundMessage.getExpirationStartTimestamp()
) {
const expirationMode = changeToDisappearingConversationMode(
convo,

@ -138,7 +138,7 @@ async function handleMessageSentSuccess(
convo &&
expirationType &&
expireTimer > 0 &&
Boolean(fetchedMessage.get('expirationStartTimestamp')) === false
Boolean(fetchedMessage.getExpirationStartTimestamp()) === false
) {
const expirationMode = changeToDisappearingConversationMode(convo, expirationType, expireTimer);

Loading…
Cancel
Save