Process timer changes before calc_timestamps()

This way system message about timer change gets lower timestamp than the
message itself, and it is clear that new timer is applied to the message
that just arrived.
This commit is contained in:
Alexander Krotov
2020-05-15 03:14:32 +03:00
parent 5523e7ba19
commit 032b387c95

View File

@@ -591,18 +591,6 @@ fn add_parts(
*chat_id = ChatId::new(DC_CHAT_ID_TRASH);
}
}
// correct message_timestamp, it should not be used before,
// however, we cannot do this earlier as we need from_id to be set
calc_timestamps(
context,
*chat_id,
from_id,
*sent_timestamp,
!seen,
&mut sort_timestamp,
sent_timestamp,
&mut rcvd_timestamp,
);
// Extract autodelete timer from the message.
let timer = if let Some(value) = mime_parser.get(HeaderDef::AutodeleteTimer) {
@@ -645,6 +633,19 @@ fn add_parts(
}
}
// correct message_timestamp, it should not be used before,
// however, we cannot do this earlier as we need from_id to be set
calc_timestamps(
context,
*chat_id,
from_id,
*sent_timestamp,
!seen,
&mut sort_timestamp,
sent_timestamp,
&mut rcvd_timestamp,
);
// unarchive chat
chat_id.unarchive(context)?;