mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-14 12:51:08 +00:00
Only create suggestions stores for local users
This commit is contained in:
parent
2ff79c9953
commit
f98576bc25
1 changed files with 5 additions and 1 deletions
|
@ -146,14 +146,18 @@ def add_or_remove_on_discoverability_change(
|
|||
sender, instance, created, raw, using, update_fields, **kwargs
|
||||
):
|
||||
"""make a user (un)discoverable"""
|
||||
if created:
|
||||
if created and instance.local:
|
||||
# a new user is found, create suggestions for them
|
||||
suggested_users.rerank_user_suggestions(instance)
|
||||
|
||||
if not created and (not update_fields or not "discoverable" in update_fields):
|
||||
# this is just a regular old user update, not related to discoverability
|
||||
return
|
||||
|
||||
if instance.discoverable:
|
||||
# add this user to all suitable stores
|
||||
suggested_users.rerank_obj(instance, update_only=False)
|
||||
|
||||
elif not created and not instance.discoverable:
|
||||
# remove this user from all suitable stores
|
||||
suggested_users.remove_object_from_related_stores(instance)
|
||||
|
|
Loading…
Reference in a new issue