thrownewError('removeMessage: only takes single message to delete!');
return;
}
assertGlobalInstanceOrInstance(instance)
@ -1008,6 +1009,48 @@ function removeAllMessagesInConversation(
.run({conversationId});
}
functioncleanUpExpirationTimerUpdateHistory(
conversationId: string,
isPrivate: boolean,
db?: BetterSqlite3.Database
){
if(isEmpty(conversationId)){
return[];
}
constrows=assertGlobalInstanceOrInstance(db)
.prepare(
`SELECT id, source FROM ${MESSAGES_TABLE} WHERE conversationId = $conversationId and flags = ${SignalService.DataMessage.Flags.EXPIRATION_TIMER_UPDATE}${orderByClause}`
)
.all({conversationId});
if(rows.length<=1){
return[];
}
// we want to allow 1 message at most per sender for private chats only
constbySender: Record<string,Array<string>>={};
// we keep the order, so the first message of each array should be kept, the other ones discarded
// TODO: the expiration is due to be returned by the storage server on "store" soon, we will then be able to use it instead of doing the storedAt + ttl logic below
// if we have a hash and a storedAt, mark it as seen so we don't reprocess it on the next retrieve