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 @@