fix: Apply reactions that arrived before the message at later time#8415
Open
j-g00da wants to merge 1 commit into
Open
fix: Apply reactions that arrived before the message at later time#8415j-g00da wants to merge 1 commit into
j-g00da wants to merge 1 commit into
Conversation
aad07f3 to
86e0819
Compare
A new table `pending_reactions` is now used, to store reactions that arrived before the referenced message. When receiving a new message, pending_reactions is checked and any reactions that arrived earlier are applied. Fixes: #8367 Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
86e0819 to
dec393e
Compare
j-g00da
commented
Jul 15, 2026
| for (contact_id, (chat_id, reaction, timestamp)) in pending_reactions { | ||
| if !set_msg_reaction_if_present( | ||
| context, rfc724_mid, chat_id, contact_id, timestamp, &reaction, | ||
| true, // todo: how to treat this? |
Contributor
Author
There was a problem hiding this comment.
not really sure what is supposed to go in here?
j-g00da
commented
Jul 15, 2026
Comment on lines
+930
to
+940
| /// Removes pending reactions that weren't applied for 90 days. | ||
| async fn remove_old_pending_reactions(context: &Context) -> Result<usize> { | ||
| let three_months_ago = time().saturating_sub(60 * 60 * 24 * 90); | ||
| context | ||
| .sql | ||
| .execute( | ||
| "DELETE FROM pending_reactions WHERE timestamp < ?", | ||
| (three_months_ago,), | ||
| ) | ||
| .await | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Three months is arbitrary, I didn't create a separate constant for this as this is not that important.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A new table
pending_reactionsis now used,to store reactions that arrived before the referenced message.
When receiving a new message, pending_reactions is checked and any reactions that arrived earlier are applied.
Fixes: #8367