fix: run expireUpdate handler on all messages and just return the model if there are no changes

pull/2660/head
William Grant 2 years ago
parent a9f4cd3d1c
commit c6cd3671de

@ -243,13 +243,11 @@ export async function handleSwarmDataMessage(
sentAt: sentAtTimestamp, sentAt: sentAtTimestamp,
}); });
if (expireUpdate && !isEmpty(expireUpdate)) { if (isSyncedMessage) {
if (isSyncedMessage) { // TODO handle sync messages expiring separately?
// TODO handle sync messages expiring separately? window.log.debug('WIP: Sync Message dropping');
window.log.debug('WIP: Sync Message dropping'); } else {
} else { msgModel = handleExpireUpdate(convoToAddMessageTo, msgModel, expireUpdate);
msgModel = handleExpireUpdate(convoToAddMessageTo, msgModel, expireUpdate);
}
} }
await handleSwarmMessage( await handleSwarmMessage(

@ -22,8 +22,9 @@ export type DisappearingMessageType = typeof DisappearingMessageMode[number] | n
export const DisappearingMessageConversationSetting = ['off', ...DisappearingMessageMode, 'legacy']; export const DisappearingMessageConversationSetting = ['off', ...DisappearingMessageMode, 'legacy'];
export type DisappearingMessageConversationType = typeof DisappearingMessageConversationSetting[number]; export type DisappearingMessageConversationType = typeof DisappearingMessageConversationSetting[number];
export const DEFAULT_TIMER_OPTION = { export const DEFAULT_TIMER_OPTION = {
PRIVATE_CONVERSATION: 86400, // 1 day DELETE_AFTER_READ: 43200, // 12 hours
GROUP: 43200, // 12 hours DELETE_AFTER_SEND: 86400, // 1 day
LEGACY: 86400, // 1 day
}; };
export type DisappearingMessageUpdate = { export type DisappearingMessageUpdate = {
@ -353,8 +354,12 @@ export async function checkForExpireUpdate(
export function handleExpireUpdate( export function handleExpireUpdate(
converationModel: ConversationModel, converationModel: ConversationModel,
messageModel: MessageModel, messageModel: MessageModel,
expireUpdate: DisappearingMessageUpdate expireUpdate?: DisappearingMessageUpdate
) { ) {
if (!expireUpdate) {
return messageModel;
}
if (converationModel.isPublic()) { if (converationModel.isPublic()) {
window.log.warn("updateExpireTimer() Disappearing messages aren't supported in communities"); window.log.warn("updateExpireTimer() Disappearing messages aren't supported in communities");
return messageModel; return messageModel;

Loading…
Cancel
Save