From 29a182540ad25d82c4834a68a447750373914380 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 23 Sep 2021 21:45:11 +0200 Subject: [PATCH] fds --- files/classes/comment.py | 2 +- files/classes/submission.py | 1 - files/routes/comments.py | 3 ++- files/templates/comments.html | 18 +++++++++--------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 2fd39a53e..6f8596fc2 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -44,7 +44,7 @@ class Comment(Base): over_18 = Column(Boolean, default=False) is_bot = Column(Boolean, default=False) - is_pinned = Column(Boolean, default=False) + is_pinned = Column(String, default=False) sentto=Column(Integer) app_id = Column(Integer, ForeignKey("oauth_apps.id")) diff --git a/files/classes/submission.py b/files/classes/submission.py index 0b1bbba08..0fb8bc78e 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -56,7 +56,6 @@ class Submission(Base): is_approved = Column(Integer, ForeignKey("users.id"), default=0) over_18 = Column(Boolean, default=False) author = relationship("User", primaryjoin="Submission.author_id==User.id") - is_pinned = Column(Boolean, default=False) is_bot = Column(Boolean, default=False) upvotes = Column(Integer, default=1) diff --git a/files/routes/comments.py b/files/routes/comments.py index b3bbaee12..339352e13 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -869,7 +869,8 @@ def toggle_comment_pin(cid, v): if v.admin_level < 1 and v.id != comment.post.author_id: abort(403) - comment.is_pinned = not comment.is_pinned + if comment.is_pinned: comment.is_pinned = None + else: comment.is_pinned = v.username g.db.add(comment) g.db.flush() diff --git a/files/templates/comments.html b/files/templates/comments.html index c0af9b983..b4e2e487f 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -136,7 +136,7 @@
- {% if last_view_utc and c.created_utc > last_view_utc and not (v and v.id==c.author_id) and (not v or v.highlightcomments) %}{% endif %} + {% if last_view_utc and c.created_utc > last_view_utc and not (v and v.id==c.author_id) and (not v or v.highlightcomments) %}{% endif %} {% if c.awards %} {% for a in c.awards[:5] %} @@ -145,20 +145,20 @@ {% endif %} {% if c.bannedfor and c.author.banned_by %} - + {% endif %} {% if c.active_flags %}{{c.active_flags}} Reports{% endif %} {% if c.over_18 %}+18{% endif %} {% if v and v.admin_level==6 and c.author.shadowbanned %}{% endif %} - {% if c.is_pinned %}{% endif %} - {% if c.distinguish_level %}{% endif %} - {% if c.is_op %}{% endif %} - {% if c.is_bot %}{% endif %} - {% if c.is_blocking %}{% endif %} - {% if c.is_blocked %}{% endif %} + {% if c.is_pinned %}{% endif %} + {% if c.distinguish_level %}{% endif %} + {% if c.is_op %}{% endif %} + {% if c.is_bot %}{% endif %} + {% if c.is_blocking %}{% endif %} + {% if c.is_blocked %}{% endif %} - {% if c.author.verified %} + {% if c.author.verified %} {% endif %} {{c.author.username}}{% if c.author.customtitle %}  {% if c.author.quadrant %}{% endif %}{{c.author.customtitle | safe}}{% endif %}