make ?context=8 default

pull/80/head
Aevann1 2022-12-18 16:48:48 +02:00
parent e0bc8a22e2
commit 6cde4a040c
7 changed files with 11 additions and 11 deletions

View File

@ -160,8 +160,8 @@ class Comment(Base):
@lazy
def shortlink(self):
if self.wall_user_id:
return f"/@{self.wall_user.username}/wall/comment/{self.id}?context=8#context"
return f"{self.post.shortlink}/{self.id}?context=8#context"
return f"/@{self.wall_user.username}/wall/comment/{self.id}#context"
return f"{self.post.shortlink}/{self.id}#context"
@property
@lazy

View File

@ -59,7 +59,7 @@ class ModAction(Base):
if self.target_user: return f'<a href="{self.target_user.url}">{self.target_user.username}</a>'
elif self.target_post:
return censor_slurs(f'<a href="{self.target_post.permalink}">{self.target_post.title_html}</a>', None)
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}?context=8#context">comment</a>'
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}#context">comment</a>'
@property
@lazy

View File

@ -51,7 +51,7 @@ class SubAction(Base):
if self.target_user: return f'<a href="{self.target_user.url}">{self.target_user.username}</a>'
elif self.target_post:
return censor_slurs(f'<a href="{self.target_post.permalink}">{self.target_post.title_html}</a>', None)
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}?context=8#context">comment</a>'
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}#context">comment</a>'
@property
@lazy

View File

@ -217,7 +217,7 @@ def award_thing(v, thing_type, id):
link = f"/{thing_type}/{thing.id}"
link2 = link
if thing_type == 'comment':
link2 += '?context=8'
link2 += '#context'
ban_reason = f'1-Day ban award used by <a href="/@{v.username}">@{v.username}</a> on <a href="{link2}">{link}</a>'
if not author.is_suspended:
author.ban(reason=ban_reason, days=1)

View File

@ -51,8 +51,8 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
if v and v.client: abort(403, "This content is not suitable for some users and situations.")
else: return render_template("errors/nsfw.html", v=v), 403
try: context = min(int(request.values.get("context", 0)), 8)
except: context = 0
try: context = min(int(request.values.get("context", 8)), 8)
except: context = 8
comment_info = comment
c = comment
while context and c.level > 1:
@ -307,7 +307,7 @@ def comment(v:User):
if len(c.body) > PUSH_NOTIF_LIMIT: notifbody = c.body[:PUSH_NOTIF_LIMIT] + '...'
else: notifbody = c.body
url = f'{SITE_FULL}/comment/{c.id}?context=8&read=true#context'
url = f'{SITE_FULL}/comment/{c.id}?read=true#context'
push_notif(parent_user.id, title, notifbody, url)

View File

@ -65,7 +65,7 @@ def exile_comment(v:User, cid):
kind='exile_user',
user_id=v.id,
target_user_id=u.id,
_note=f'for <a href="/comment/{c.id}?context=8#context">comment</a>'
_note=f'for <a href="/comment/{c.id}#context">comment</a>'
)
g.db.add(ma)

View File

@ -814,8 +814,8 @@ def u_username_wall_comment(v:User, username:str, cid):
g.db.add(notif)
g.db.commit()
try: context = min(int(request.values.get("context", 0)), 8)
except: context = 0
try: context = min(int(request.values.get("context", 8)), 8)
except: context = 8
comment_info = comment
c = comment
while context and c.level > 1: