forked from MarseyWorld/MarseyWorld
minor logic change in /@username
parent
8917427323
commit
a6b7fed2fc
|
@ -57,21 +57,26 @@ 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:
|
||||
block = g.db.query(UserBlock).filter(
|
||||
or_(
|
||||
and_(
|
||||
UserBlock.user_id == v.id,
|
||||
UserBlock.target_id == user.id
|
||||
),
|
||||
and_(UserBlock.user_id == user.id,
|
||||
UserBlock.target_id == v.id
|
||||
)
|
||||
)
|
||||
).first()
|
||||
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_(
|
||||
UserBlock.user_id == v.id,
|
||||
UserBlock.target_id == user.id
|
||||
),
|
||||
and_(UserBlock.user_id == user.id,
|
||||
UserBlock.target_id == v.id
|
||||
)
|
||||
)
|
||||
).first()
|
||||
|
||||
user.is_blocking = block and block.user_id == v.id
|
||||
user.is_blocked = block and block.target_id == v.id
|
||||
|
||||
user.is_blocking = block and block.user_id == v.id
|
||||
user.is_blocked = block and block.target_id == v.id
|
||||
|
||||
return user
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in New Issue