mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-30 05:21:08 +00:00
Fixes logic error in checking relationships
I had the logic backwards for pending relationships.
This commit is contained in:
parent
4ccbfb6b31
commit
e16506c1df
2 changed files with 4 additions and 4 deletions
|
@ -218,7 +218,7 @@ def clear_cache(user_subject, user_object):
|
||||||
"""clear relationship cache"""
|
"""clear relationship cache"""
|
||||||
cache.delete_many(
|
cache.delete_many(
|
||||||
[
|
[
|
||||||
f"relationship-{user_subject.id}-{user_object.id}",
|
f"cached-relationship-{user_subject.id}-{user_object.id}",
|
||||||
f"relationship-{user_object.id}-{user_subject.id}",
|
f"cached-relationship-{user_object.id}-{user_subject.id}",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -42,7 +42,7 @@ def get_relationship(context, user_object):
|
||||||
"""caches the relationship between the logged in user and another user"""
|
"""caches the relationship between the logged in user and another user"""
|
||||||
user = context["request"].user
|
user = context["request"].user
|
||||||
return get_or_set(
|
return get_or_set(
|
||||||
f"relationship-{user.id}-{user_object.id}",
|
f"cached-relationship-{user.id}-{user_object.id}",
|
||||||
get_relationship_name,
|
get_relationship_name,
|
||||||
user,
|
user,
|
||||||
user_object,
|
user_object,
|
||||||
|
@ -61,6 +61,6 @@ def get_relationship_name(user, user_object):
|
||||||
types["is_blocked"] = True
|
types["is_blocked"] = True
|
||||||
elif user_object in user.following.all():
|
elif user_object in user.following.all():
|
||||||
types["is_following"] = True
|
types["is_following"] = True
|
||||||
elif user_object in user.follower_requests.all():
|
elif user in user_object.follower_requests.all():
|
||||||
types["is_follow_pending"] = True
|
types["is_follow_pending"] = True
|
||||||
return types
|
return types
|
||||||
|
|
Loading…
Reference in a new issue