minor logic change in /@username

master
Aevann1 2022-07-03 14:12:33 +02:00
parent 8917427323
commit a6b7fed2fc
2 changed files with 19 additions and 18 deletions

View File

@ -57,7 +57,11 @@ def get_user(username, v=None, graceful=False, rendered=False):
if not graceful: abort(404)
else: return None
if rendered and v and v.id != user.id:
if rendered and v:
if v.id == user.id:
user.is_blocked = False
user.is_blocking = False
else:
block = g.db.query(UserBlock).filter(
or_(
and_(
@ -73,6 +77,7 @@ def get_user(username, v=None, graceful=False, rendered=False):
user.is_blocking = block and block.user_id == v.id
user.is_blocked = block and block.target_id == v.id
return user
def get_users(usernames, v=None, graceful=False):

View File

@ -876,8 +876,6 @@ def u_username(username, v=None):
if v and username == v.username:
is_following = False
u.is_blocked = False
u.is_blocking = False
else:
is_following = (v and u.has_follower(v))
@ -974,8 +972,6 @@ def u_username_comments(username, v=None):
if v and username == v.username:
is_following = False
user.is_blocked = False
user.is_blocking = False
else:
is_following = (v and user.has_follower(v))