Skip to content

fix: Apply reactions that arrived before the message at later time#8415

Open
j-g00da wants to merge 1 commit into
mainfrom
j-g00da/pending-reactions
Open

fix: Apply reactions that arrived before the message at later time#8415
j-g00da wants to merge 1 commit into
mainfrom
j-g00da/pending-reactions

Conversation

@j-g00da

@j-g00da j-g00da commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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

@j-g00da j-g00da force-pushed the j-g00da/pending-reactions branch 3 times, most recently from aad07f3 to 86e0819 Compare July 15, 2026 17:40
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>
@j-g00da j-g00da force-pushed the j-g00da/pending-reactions branch from 86e0819 to dec393e Compare July 15, 2026 18:00
@j-g00da j-g00da marked this pull request as ready for review July 15, 2026 18:00
@j-g00da j-g00da changed the title WIP: fix: Apply reactions that arrived before the message at later time fix: Apply reactions that arrived before the message at later time Jul 15, 2026
Comment thread src/reaction.rs
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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really sure what is supposed to go in here?

Comment thread src/sql.rs
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
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three months is arbitrary, I didn't create a separate constant for this as this is not that important.

@j-g00da j-g00da requested review from Hocuri and link2xt July 15, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reactions received before the message reacted to are trashed

1 participant