Stories: Start expiration on receipt
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
8f8cf98e3b
commit
8daac4ab8e
|
@ -2646,6 +2646,12 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
|||
!isExpirationTimerUpdate(dataMessage)
|
||||
) {
|
||||
message.set({ expireTimer: dataMessage.expireTimer });
|
||||
if (isStory(message.attributes)) {
|
||||
log.info(`${idLog}: Starting story expiration`);
|
||||
message.set({
|
||||
expirationStartTimestamp: dataMessage.timestamp,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasGroupV2Prop && !isStory(message.attributes)) {
|
||||
|
|
|
@ -1060,6 +1060,10 @@ export function reducer(
|
|||
isDownloaded(newStory.attachment);
|
||||
const hasAttachmentFailed =
|
||||
hasFailed(newStory.attachment) && !hasFailed(prevStory.attachment);
|
||||
const hasExpirationChanged =
|
||||
(newStory.expirationStartTimestamp &&
|
||||
!prevStory.expirationStartTimestamp) ||
|
||||
(newStory.expireTimer && !prevStory.expireTimer);
|
||||
const readStatusChanged = prevStory.readStatus !== newStory.readStatus;
|
||||
const reactionsChanged =
|
||||
prevStory.reactions?.length !== newStory.reactions?.length;
|
||||
|
@ -1075,6 +1079,7 @@ export function reducer(
|
|||
hasAttachmentDownloaded ||
|
||||
hasAttachmentFailed ||
|
||||
hasBeenDeleted ||
|
||||
hasExpirationChanged ||
|
||||
hasSendStateChanged ||
|
||||
readStatusChanged ||
|
||||
reactionsChanged;
|
||||
|
|
Loading…
Reference in New Issue