Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use shared inboxes for mentions too #3257

Merged
merged 2 commits into from
Feb 3, 2024

Conversation

dato
Copy link
Contributor

@dato dato commented Jan 26, 2024

This avoids duplicate submissions to remote instances when mentioning followers (i.e., POST /user/foo/inbox followed by POST /inbox, which results in two separate add_status tasks, and might generate duplicates in the target instance).


See, for example, https://lectura.social/user/ArianeDeTroil/comment/58073, where a single comment from my instance generated three copies of the note (because there were two mentions to the same instance). I believe the first commit fixes the issue.

This avoids duplicate submissions to remote instances when mentioning
followers (i.e., `POST /user/foo/inbox` followed by `POST /inbox`, which
results in two separate `add_status` tasks, and might generate duplicates
in the target instance).
@dato dato marked this pull request as ready for review January 26, 2024 09:41
recipients = [u.inbox for u in mentions or [] if not u.local]
# we always send activities to explicitly mentioned users (using shared inboxes
# where available to avoid duplicate submissions to a given instance)
recipients = {u.shared_inbox or u.inbox for u in mentions if not u.local}
Copy link
Member

Choose a reason for hiding this comment

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

I didn't realize you could create sets this way, this is great! Thank you

@mouse-reeve mouse-reeve merged commit 0f0420c into bookwyrm-social:main Feb 3, 2024
10 checks passed
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.

2 participants