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,
});
if (expireUpdate && !isEmpty(expireUpdate)) {
if (isSyncedMessage) {
// TODO handle sync messages expiring separately?
window.log.debug('WIP: Sync Message dropping');
} else {
msgModel = handleExpireUpdate(convoToAddMessageTo, msgModel, expireUpdate);
}
if (isSyncedMessage) {
// TODO handle sync messages expiring separately?
window.log.debug('WIP: Sync Message dropping');
} else {
msgModel = handleExpireUpdate(convoToAddMessageTo, msgModel, expireUpdate);
}
await handleSwarmMessage(

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

Loading…
Cancel
Save