diff --git a/files/classes/comment.py b/files/classes/comment.py index 968540997..99bfd1b8a 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -8,6 +8,9 @@ from files.helpers.const import SLURS from files.__main__ import Base from .mix_ins import * from .flags import CommentFlag +from os import environ + +site = environ.get("DOMAIN").strip() class CommentAux(Base): @@ -139,6 +142,11 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing): if not r and r != []: r = sorted([x for x in self.child_comments], key=lambda x: x.score, reverse=True) return r + @property + @lazy + def shortlink(self): + return f"https://{site}/comment/{self.id}" + @property @lazy def permalink(self): diff --git a/files/classes/submission.py b/files/classes/submission.py index 024363e76..5d1e1acc5 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -119,7 +119,12 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): @lazy def fullname(self): return f"t2_{self.id}" - + + @property + @lazy + def shortlink(self): + return f"https://{site}/post/{self.id}" + @property @lazy def permalink(self): diff --git a/files/templates/comments.html b/files/templates/comments.html index b74080cd2..ee6b02c5d 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -333,7 +333,7 @@ {% if v and v.admin_level==6 and v.id != c.author_id %}