diff --git a/files/classes/comment.py b/files/classes/comment.py
index 49c0e953e..0fa052e91 100644
--- a/files/classes/comment.py
+++ b/files/classes/comment.py
@@ -224,17 +224,17 @@ class Comment(Base):
@property
@lazy
def shortlink(self):
- return f"{self.post.permalink}/{self.id}#context"
-
- @property
- @lazy
- def sl(self):
return f"{self.post.shortlink}/{self.id}?context=8#context"
@property
@lazy
def permalink(self):
- return f"{SITE_FULL}{self.sl}"
+ return f"{SITE_FULL}{self.shortlink}"
+
+ @property
+ @lazy
+ def morecomments(self):
+ return f"{self.post.permalink}/{self.id}#context"
@property
@lazy
diff --git a/files/classes/submission.py b/files/classes/submission.py
index 760dc4181..8231f1cc9 100644
--- a/files/classes/submission.py
+++ b/files/classes/submission.py
@@ -208,16 +208,10 @@ class Submission(Base):
@property
@lazy
- def sl(self):
+ def shortlink(self):
link = f"/post/{self.id}"
if self.sub: link = f"/s/{self.sub}{link}"
- return link
-
- @property
- @lazy
- def shortlink(self):
- link = self.sl
if self.club: return link
output = self.title.lower()
diff --git a/files/routes/admin.py b/files/routes/admin.py
index c0f2e44ad..2b251b34d 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -119,13 +119,13 @@ def distribute(v, comment):
votes = g.db.query(CommentVote).filter_by(comment_id=comment)
coinsperperson = int(pool / votes.count())
- cid = notif_comment(f"You won {coinsperperson} coins betting on [{post.title}]({post.sl}) :marseyparty:")
+ cid = notif_comment(f"You won {coinsperperson} coins betting on [{post.title}]({post.shortlink}) :marseyparty:")
for vote in votes:
u = vote.user
u.coins += coinsperperson
add_notif(cid, u.id)
- cid = notif_comment(f"You lost the 200 coins you bet on [{post.title}]({post.sl}) :marseylaugh:")
+ cid = notif_comment(f"You lost the 200 coins you bet on [{post.title}]({post.shortlink}) :marseylaugh:")
cids = [x.id for x in post.bet_options]
cids.remove(comment)
votes = g.db.query(CommentVote).filter(CommentVote.comment_id.in_(cids)).all()
@@ -1296,7 +1296,7 @@ def sticky_comment(cid, v):
g.db.add(ma)
if v.id != comment.author_id:
- message = f"@{v.username} has pinned your [comment]({comment.sl})!"
+ message = f"@{v.username} has pinned your [comment]({comment.shortlink})!"
send_repeatable_notification(comment.author_id, message)
g.db.commit()
@@ -1323,7 +1323,7 @@ def unsticky_comment(cid, v):
g.db.add(ma)
if v.id != comment.author_id:
- message = f"@{v.username} has unpinned your [comment]({comment.sl})!"
+ message = f"@{v.username} has unpinned your [comment]({comment.shortlink})!"
send_repeatable_notification(comment.author_id, message)
g.db.commit()
diff --git a/files/routes/awards.py b/files/routes/awards.py
index 653d33698..b5555e2c7 100644
--- a/files/routes/awards.py
+++ b/files/routes/awards.py
@@ -228,7 +228,7 @@ def award_post(pid, v):
author = post.author
if v.id != author.id:
- msg = f"@{v.username} has given your [post]({post.sl}) the {AWARDS[kind]['title']} Award!"
+ msg = f"@{v.username} has given your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
@@ -236,7 +236,7 @@ def award_post(pid, v):
return {"error": "You can't use this award on yourself."}, 400
if kind == "ban":
- link = f"[this post]({post.sl})"
+ link = f"[this post]({post.shortlink})"
if not author.is_suspended:
author.ban(reason=f"1-Day ban award used by @{v.username} on /post/{post.id}", days=1)
@@ -259,7 +259,7 @@ def award_post(pid, v):
author.is_banned = AUTOJANNY_ID
author.ban_reason = f"grass award used by @{v.username} on /post/{post.id}"
author.unban_utc = int(time.time()) + 30 * 86400
- link = f"[this post]({post.sl})"
+ link = f"[this post]({post.shortlink})"
send_repeatable_notification(author.id, f"Your account has been suspended permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass to get unbanned!")
elif kind == "pin":
if post.stickied and post.stickied_utc:
@@ -461,7 +461,7 @@ def award_comment(cid, v):
author = c.author
if v.id != author.id:
- msg = f"@{v.username} has given your [comment]({c.sl}) the {AWARDS[kind]['title']} Award!"
+ msg = f"@{v.username} has given your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
@@ -469,7 +469,7 @@ def award_comment(cid, v):
return {"error": "You can't use this award on yourself."}, 400
if kind == "ban":
- link = f"[this comment]({c.sl})"
+ link = f"[this comment]({c.shortlink})"
if not author.is_suspended:
author.ban(reason=f"1-Day ban award used by @{v.username} on /comment/{c.id}", days=1)
@@ -492,7 +492,7 @@ def award_comment(cid, v):
author.is_banned = AUTOJANNY_ID
author.ban_reason = f"grass award used by @{v.username} on /comment/{c.id}"
author.unban_utc = int(time.time()) + 30 * 86400
- link = f"[this comment]({c.sl})"
+ link = f"[this comment]({c.shortlink})"
send_repeatable_notification(author.id, f"Your account has been suspended permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass to get unbanned!")
elif kind == "pin":
if c.is_pinned and c.is_pinned_utc: c.is_pinned_utc += 3600
diff --git a/files/routes/comments.py b/files/routes/comments.py
index 36bff5aa6..f67dd6786 100644
--- a/files/routes/comments.py
+++ b/files/routes/comments.py
@@ -956,8 +956,8 @@ def pin_comment(cid, v):
g.db.add(comment)
if v.id != comment.author_id:
- if comment.post.ghost: message = f"OP has pinned your [comment]({comment.sl})!"
- else: message = f"@{v.username} (OP) has pinned your [comment]({comment.sl})!"
+ if comment.post.ghost: message = f"OP has pinned your [comment]({comment.shortlink})!"
+ else: message = f"@{v.username} (OP) has pinned your [comment]({comment.shortlink})!"
send_repeatable_notification(comment.author_id, message)
g.db.commit()
@@ -980,7 +980,7 @@ def unpin_comment(cid, v):
g.db.add(comment)
if v.id != comment.author_id:
- message = f"@{v.username} (OP) has unpinned your [comment]({comment.sl})!"
+ message = f"@{v.username} (OP) has unpinned your [comment]({comment.shortlink})!"
send_repeatable_notification(comment.author_id, message)
g.db.commit()
return {"message": "Comment unpinned!"}
@@ -1000,7 +1000,7 @@ def mod_pin(cid, v):
g.db.add(comment)
if v.id != comment.author_id:
- message = f"@{v.username} (Mod) has pinned your [comment]({comment.sl})!"
+ message = f"@{v.username} (Mod) has pinned your [comment]({comment.shortlink})!"
send_repeatable_notification(comment.author_id, message)
g.db.commit()
@@ -1020,7 +1020,7 @@ def mod_unpin(cid, v):
g.db.add(comment)
if v.id != comment.author_id:
- message = f"@{v.username} (Mod) has unpinned your [comment]({comment.sl})!"
+ message = f"@{v.username} (Mod) has unpinned your [comment]({comment.shortlink})!"
send_repeatable_notification(comment.author_id, message)
g.db.commit()
return {"message": "Comment unpinned!"}
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 82929db4e..912320541 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -99,14 +99,14 @@ def publish(pid, v):
if not post.ghost:
notify_users = NOTIFY_USERS(post.body_html, v) | NOTIFY_USERS2(post.title, v)
- text = f"@{v.username} has mentioned you: [{post.title}]({post.sl})"
+ text = f"@{v.username} has mentioned you: [{post.title}]({post.shortlink})"
if post.sub: text += f" in /s/{post.sub}"
cid = notif_comment(text)
for x in notify_users:
add_notif(cid, x)
- text = f"@{v.username} has made a new post: [{post.title}]({post.sl})"
+ text = f"@{v.username} has made a new post: [{post.title}]({post.shortlink})"
if post.sub: text += f" in /s/{post.sub}"
cid = notif_comment(text, autojanny=True)
@@ -610,7 +610,7 @@ def edit_post(pid, v):
if not p.private and not p.ghost:
notify_users = NOTIFY_USERS(body_html, v) | NOTIFY_USERS2(title, v)
- cid = notif_comment(f"@{v.username} has mentioned you: [{p.title}]({p.sl})")
+ cid = notif_comment(f"@{v.username} has mentioned you: [{p.title}]({p.shortlink})")
for x in notify_users:
add_notif(cid, x)
@@ -1219,14 +1219,14 @@ def submit_post(v, sub=None):
notify_users = NOTIFY_USERS(body_html, v) | NOTIFY_USERS2(title, v)
- text = f"@{v.username} has mentioned you: [{post.title}]({post.sl})"
+ text = f"@{v.username} has mentioned you: [{post.title}]({post.shortlink})"
if post.sub: text += f" in /s/{post.sub}"
cid = notif_comment(text)
for x in notify_users:
add_notif(cid, x)
- text = f"@{v.username} has made a new post: [{post.title}]({post.sl})"
+ text = f"@{v.username} has made a new post: [{post.title}]({post.shortlink})"
if post.sub: text += f" in /s/{post.sub}"
cid = notif_comment(text, autojanny=True)
diff --git a/files/routes/subs.py b/files/routes/subs.py
index 28702777c..9c38d33c9 100644
--- a/files/routes/subs.py
+++ b/files/routes/subs.py
@@ -29,7 +29,7 @@ def exile_post(v, pid):
exile = Exile(user_id=u.id, sub=sub, exiler_id=v.id)
g.db.add(exile)
- send_notification(u.id, f"@{v.username} has exiled you from /s/{sub} for [{p.title}]({p.sl})")
+ send_notification(u.id, f"@{v.username} has exiled you from /s/{sub} for [{p.title}]({p.shortlink})")
g.db.commit()
@@ -82,7 +82,7 @@ def exile_comment(v, cid):
exile = Exile(user_id=u.id, sub=sub, exiler_id=v.id)
g.db.add(exile)
- send_notification(u.id, f"@{v.username} has exiled you from /s/{sub} for [{c.permalink}]({c.sl})")
+ send_notification(u.id, f"@{v.username} has exiled you from /s/{sub} for [{c.permalink}]({c.shortlink})")
g.db.commit()
diff --git a/files/templates/comments.html b/files/templates/comments.html
index 5d12c9477..22a2f41df 100644
--- a/files/templates/comments.html
+++ b/files/templates/comments.html
@@ -93,12 +93,12 @@
{% endfor %}