From 19d85aaeb5564eb0aa1726f7dcd901b57f3f8254 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 12 Sep 2021 08:12:44 +0200 Subject: [PATCH] fd --- files/classes/comment.py | 8 ++++++++ files/classes/submission.py | 7 ++++++- files/templates/comments.html | 4 ++-- files/templates/submission.html | 4 ++-- files/templates/submission_listing.html | 4 ++-- 5 files changed, 20 insertions(+), 7 deletions(-) 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 %}
  • Unban user
  • -
  • Ban user
  • +
  • Ban user
  • {% endif %} {% if v and v.admin_level >=4 and c.oauth_app %} @@ -490,7 +490,7 @@ {% if v and (c.post and v.admin_level == 6) %} {% if c.author_id != v.id %} -
  • Ban user
  • +
  • Ban user
  • Unban user
  • {% endif %} {% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 99113f5a7..1dd977936 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -176,7 +176,7 @@ {% endif %} {% if v and v.admin_level == 6 and v.id!=p.author_id %} - + {% endif %} @@ -478,7 +478,7 @@ {% endif %} {% if v.admin_level >=3 and v.id!=p.author_id %} -
  • Ban user
  • +
  • Ban user
  • Unban user
  • {% endif %} {% endif %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 58fe183b0..a4738a298 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -205,7 +205,7 @@ {% endif %} {% if v.admin_level >=3 and v.id!=p.author_id %} -
  • Ban user
  • +
  • Ban user
  • Unban user
  • {% endif %} {% endif %} @@ -364,7 +364,7 @@ {% endif %} {% if v and v.admin_level == 6 and v.id!=p.author_id %} - + {% endif %}