refactor: changetodisappearingmessageconversationtype to changetodisappearingconversationmode

pull/2971/head
William Grant 2 years ago
parent 515805b94d
commit a484011acb

@ -91,7 +91,7 @@ import { roomHasBlindEnabled } from '../types/sqlSharedTypes';
import { import {
ExpirationTimerOptions, ExpirationTimerOptions,
setExpirationStartTimestamp, setExpirationStartTimestamp,
changeToDisappearingMessageConversationType, changeToDisappearingConversationMode,
checkForExpireUpdateInContentMessage, checkForExpireUpdateInContentMessage,
updateMessageExpiryOnSwarm, updateMessageExpiryOnSwarm,
} from '../util/expiringMessages'; } from '../util/expiringMessages';
@ -267,7 +267,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
return ''; return '';
} }
const expirationMode = changeToDisappearingMessageConversationType( const expirationMode = changeToDisappearingConversationMode(
convo, convo,
expireTimerUpdate?.expirationType, expireTimerUpdate?.expirationType,
expireTimer expireTimer
@ -334,7 +334,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
} }
const { expireTimer, fromSync, source } = timerUpdate; const { expireTimer, fromSync, source } = timerUpdate;
const expirationMode = changeToDisappearingMessageConversationType( const expirationMode = changeToDisappearingConversationMode(
convo, convo,
timerUpdate?.expirationType || 'unknown', timerUpdate?.expirationType || 'unknown',
expireTimer || 0 expireTimer || 0
@ -1111,7 +1111,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
const expireTimer = this.get('expireTimer'); const expireTimer = this.get('expireTimer');
if (canBeDeleteAfterRead && expirationType && expireTimer > 0) { if (canBeDeleteAfterRead && expirationType && expireTimer > 0) {
const expirationMode = changeToDisappearingMessageConversationType( const expirationMode = changeToDisappearingConversationMode(
convo, convo,
expirationType, expirationType,
expireTimer expireTimer

@ -15,7 +15,7 @@ import { showMessageRequestBannerOutsideRedux } from '../state/ducks/userConfig'
import { getHideMessageRequestBannerOutsideRedux } from '../state/selectors/userConfig'; import { getHideMessageRequestBannerOutsideRedux } from '../state/selectors/userConfig';
import { GoogleChrome } from '../util'; import { GoogleChrome } from '../util';
import { import {
changeToDisappearingMessageConversationType, changeToDisappearingConversationMode,
setExpirationStartTimestamp, setExpirationStartTimestamp,
} from '../util/expiringMessages'; } from '../util/expiringMessages';
import { LinkPreviews } from '../util/linkPreviews'; import { LinkPreviews } from '../util/linkPreviews';
@ -347,7 +347,7 @@ async function markConvoAsReadIfOutgoingMessage(
expireTimer > 0 && expireTimer > 0 &&
Boolean(message.get('expirationStartTimestamp')) === false Boolean(message.get('expirationStartTimestamp')) === false
) { ) {
const expirationMode = changeToDisappearingMessageConversationType( const expirationMode = changeToDisappearingConversationMode(
conversation, conversation,
expirationType, expirationType,
expireTimer expireTimer
@ -397,7 +397,7 @@ export async function handleMessageJob(
messageModel.get('expireTimer') > 0 && messageModel.get('expireTimer') > 0 &&
Boolean(messageModel.get('expirationStartTimestamp')) === false Boolean(messageModel.get('expirationStartTimestamp')) === false
) { ) {
const expirationMode = changeToDisappearingMessageConversationType( const expirationMode = changeToDisappearingConversationMode(
conversation, conversation,
messageModel.get('expirationType'), messageModel.get('expirationType'),
messageModel.get('expireTimer') messageModel.get('expireTimer')
@ -436,7 +436,7 @@ export async function handleMessageJob(
} }
const expireTimerUpdate = expirationTimerUpdate?.expireTimer || 0; const expireTimerUpdate = expirationTimerUpdate?.expireTimer || 0;
const expirationTypeUpdate = changeToDisappearingMessageConversationType( const expirationTypeUpdate = changeToDisappearingConversationMode(
conversation, conversation,
expirationTimerUpdate?.expirationType, expirationTimerUpdate?.expirationType,
expireTimerUpdate expireTimerUpdate

@ -38,7 +38,7 @@ import { ed25519Str } from '../onions/onionPath';
import { PubKey } from '../types'; import { PubKey } from '../types';
import { RawMessage } from '../types/RawMessage'; import { RawMessage } from '../types/RawMessage';
import { import {
changeToDisappearingMessageConversationType, changeToDisappearingConversationMode,
updateMessageExpiryOnSwarm, updateMessageExpiryOnSwarm,
} from '../../util/expiringMessages'; } from '../../util/expiringMessages';
@ -172,7 +172,7 @@ async function send(
// a message has started to disappear // a message has started to disappear
foundMessage.get('expirationStartTimestamp') foundMessage.get('expirationStartTimestamp')
) { ) {
const expirationMode = changeToDisappearingMessageConversationType( const expirationMode = changeToDisappearingConversationMode(
convo, convo,
expirationType, expirationType,
expireTimer expireTimer

@ -2,7 +2,7 @@ import _ from 'lodash';
import { Data } from '../../data/data'; import { Data } from '../../data/data';
import { SignalService } from '../../protobuf'; import { SignalService } from '../../protobuf';
import { import {
changeToDisappearingMessageConversationType, changeToDisappearingConversationMode,
setExpirationStartTimestamp, setExpirationStartTimestamp,
} from '../../util/expiringMessages'; } from '../../util/expiringMessages';
import { PnServer } from '../apis/push_notification_api'; import { PnServer } from '../apis/push_notification_api';
@ -140,11 +140,7 @@ async function handleMessageSentSuccess(
expireTimer > 0 && expireTimer > 0 &&
Boolean(fetchedMessage.get('expirationStartTimestamp')) === false Boolean(fetchedMessage.get('expirationStartTimestamp')) === false
) { ) {
const expirationMode = changeToDisappearingMessageConversationType( const expirationMode = changeToDisappearingConversationMode(convo, expirationType, expireTimer);
convo,
expirationType,
expireTimer
);
// NOTE starting disappearing messages timer for all outbound messages // NOTE starting disappearing messages timer for all outbound messages
if (expirationMode !== 'off') { if (expirationMode !== 'off') {

@ -352,7 +352,7 @@ export function changeToDisappearingMessageType(
* @param expireTimer * @param expireTimer
* @returns * @returns
*/ */
export function changeToDisappearingMessageConversationType( export function changeToDisappearingConversationMode(
convo: ConversationModel, convo: ConversationModel,
expirationType?: DisappearingMessageType, expirationType?: DisappearingMessageType,
expireTimer?: number expireTimer?: number
@ -437,7 +437,7 @@ export async function checkForExpireUpdateInContentMessage(
: content.expirationTimer; : content.expirationTimer;
// NOTE we don't use the expirationType directly from the Content Message because we need to resolve it to the correct convo type first in case it is legacy or has errors // NOTE we don't use the expirationType directly from the Content Message because we need to resolve it to the correct convo type first in case it is legacy or has errors
const expirationMode = changeToDisappearingMessageConversationType( const expirationMode = changeToDisappearingConversationMode(
convoToUpdate, convoToUpdate,
DisappearingMessageMode[content.expirationType], DisappearingMessageMode[content.expirationType],
expirationTimer expirationTimer

Loading…
Cancel
Save