Stories: Start expiration on receipt
This commit is contained in:
parent
d03b53d47e
commit
58f0012f14
2 changed files with 11 additions and 0 deletions
|
@ -2646,6 +2646,12 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
!isExpirationTimerUpdate(dataMessage)
|
!isExpirationTimerUpdate(dataMessage)
|
||||||
) {
|
) {
|
||||||
message.set({ expireTimer: dataMessage.expireTimer });
|
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)) {
|
if (!hasGroupV2Prop && !isStory(message.attributes)) {
|
||||||
|
|
|
@ -1222,6 +1222,10 @@ export function reducer(
|
||||||
isDownloaded(newStory.attachment);
|
isDownloaded(newStory.attachment);
|
||||||
const hasAttachmentFailed =
|
const hasAttachmentFailed =
|
||||||
hasFailed(newStory.attachment) && !hasFailed(prevStory.attachment);
|
hasFailed(newStory.attachment) && !hasFailed(prevStory.attachment);
|
||||||
|
const hasExpirationChanged =
|
||||||
|
(newStory.expirationStartTimestamp &&
|
||||||
|
!prevStory.expirationStartTimestamp) ||
|
||||||
|
(newStory.expireTimer && !prevStory.expireTimer);
|
||||||
const readStatusChanged = prevStory.readStatus !== newStory.readStatus;
|
const readStatusChanged = prevStory.readStatus !== newStory.readStatus;
|
||||||
const reactionsChanged =
|
const reactionsChanged =
|
||||||
prevStory.reactions?.length !== newStory.reactions?.length;
|
prevStory.reactions?.length !== newStory.reactions?.length;
|
||||||
|
@ -1237,6 +1241,7 @@ export function reducer(
|
||||||
hasAttachmentDownloaded ||
|
hasAttachmentDownloaded ||
|
||||||
hasAttachmentFailed ||
|
hasAttachmentFailed ||
|
||||||
hasBeenDeleted ||
|
hasBeenDeleted ||
|
||||||
|
hasExpirationChanged ||
|
||||||
hasSendStateChanged ||
|
hasSendStateChanged ||
|
||||||
readStatusChanged ||
|
readStatusChanged ||
|
||||||
reactionsChanged;
|
reactionsChanged;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue