Fixes logic error in checking relationships

I had the logic backwards for pending relationships.
This commit is contained in:
Mouse Reeve 2022-07-02 21:25:07 -07:00
parent 4ccbfb6b31
commit e16506c1df
2 changed files with 4 additions and 4 deletions

View file

@ -218,7 +218,7 @@ def clear_cache(user_subject, user_object):
"""clear relationship cache"""
cache.delete_many(
[
f"relationship-{user_subject.id}-{user_object.id}",
f"relationship-{user_object.id}-{user_subject.id}",
f"cached-relationship-{user_subject.id}-{user_object.id}",
f"cached-relationship-{user_object.id}-{user_subject.id}",
]
)

View file

@ -42,7 +42,7 @@ def get_relationship(context, user_object):
"""caches the relationship between the logged in user and another user"""
user = context["request"].user
return get_or_set(
f"relationship-{user.id}-{user_object.id}",
f"cached-relationship-{user.id}-{user_object.id}",
get_relationship_name,
user,
user_object,
@ -61,6 +61,6 @@ def get_relationship_name(user, user_object):
types["is_blocked"] = True
elif user_object in user.following.all():
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
return types