improve GLOBAL

master
Aevann 2023-07-05 21:44:57 +03:00
parent 9f8ffb528b
commit 7ed0b8b494
2 changed files with 5 additions and 5 deletions

View File

@ -298,7 +298,7 @@ def notifications_reddit(v:User):
def notifications(v:User): def notifications(v:User):
page = get_page() page = get_page()
if v.admin_level < PERMS['USER_SHADOWBAN']: if not session.get("GLOBAL") and v.admin_level < PERMS['USER_SHADOWBAN']:
unread_and_inaccessible = g.db.query(Notification).join(Notification.comment).join(Comment.author).filter( unread_and_inaccessible = g.db.query(Notification).join(Notification.comment).join(Comment.author).filter(
Notification.user_id == v.id, Notification.user_id == v.id,
Notification.read == False, Notification.read == False,

View File

@ -868,7 +868,7 @@ def u_username_wall(v:Optional[User], username:str):
is_following = v and u.has_follower(v) is_following = v and u.has_follower(v)
if v and v.id != u.id and not v.admin_level: if v and v.id != u.id and not v.admin_level and not session.get("GLOBAL"):
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none() view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
if view: view.last_view_utc = int(time.time()) if view: view.last_view_utc = int(time.time())
else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id) else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id)
@ -918,7 +918,7 @@ def u_username_wall_comment(v:User, username:str, cid):
is_following = v and u.has_follower(v) is_following = v and u.has_follower(v)
if v and v.id != u.id and not v.admin_level: if v and v.id != u.id and not v.admin_level and not session.get("GLOBAL"):
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none() view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
if view: view.last_view_utc = int(time.time()) if view: view.last_view_utc = int(time.time())
else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id) else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id)
@ -970,7 +970,7 @@ def u_username(v:Optional[User], username:str):
abort(403, f"@{u.username}'s userpage is private") abort(403, f"@{u.username}'s userpage is private")
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403 return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
if v and v.id != u.id and not v.admin_level: if v and v.id != u.id and not v.admin_level and not session.get("GLOBAL"):
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none() view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
if view: view.last_view_utc = int(time.time()) if view: view.last_view_utc = int(time.time())
else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id) else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id)
@ -1041,7 +1041,7 @@ def u_username_comments(username, v=None):
abort(403, f"@{u.username}'s userpage is private") abort(403, f"@{u.username}'s userpage is private")
return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403 return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403
if v and v.id != u.id and not v.admin_level: if v and v.id != u.id and not v.admin_level and not session.get("GLOBAL"):
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none() view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
if view: view.last_view_utc = int(time.time()) if view: view.last_view_utc = int(time.time())
else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id) else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id)