From 54fdfd15591da812b6874fc03ea9cf2cb0d39934 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sat, 11 Mar 2023 03:03:41 -0600 Subject: [PATCH] sticky api url --- files/classes/comment.py | 22 ++++ .../component/comment/actions_desktop.html | 120 ++++++++---------- .../component/comment/replybox_comment.html | 52 ++++---- .../component/comment/replybox_message.html | 16 +-- .../templates/component/comment/reports.html | 8 +- .../component/comment/user_info.html | 106 ++++++++-------- .../component/comment/voting_desktop.html | 2 +- .../component/comment/voting_mobile.html | 2 +- 8 files changed, 171 insertions(+), 157 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 39b8a8132..e3cb63323 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -463,6 +463,10 @@ class Comment(Base): @lazy def header_msg(self, v, is_notification_page:bool, reply_count:int) -> str: + ''' + Returns a message that is in the header for a comment, usually for + display on a notification page. + ''' if self.post: post_html:str = f"{self.post.realtitle(v)}" if v: @@ -497,6 +501,24 @@ class Comment(Base): if not v: return -2 if v.id == self.author_id: return 1 return getattr(self, 'voted', 0) + + @lazy + def sticky_api_url(self, v) -> Optional[str]: + ''' + Returns the API URL used to sticky this comment. + :returns: Currently `None` always. Stickying comments was disabled + UI-side on TheMotte. + ''' + return None + if not self.is_comment: return None + if not v: return None + if v.admin_level >= 2: + return 'sticky_comment' + if v.id == self.post.author_id: + return 'pin_comment' + if self.post.sub and v.mods(self.post.sub): + return 'mod_pin' + return None @lazy def active_flags(self, v): diff --git a/files/templates/component/comment/actions_desktop.html b/files/templates/component/comment/actions_desktop.html index fe2aa5741..8400745c0 100644 --- a/files/templates/component/comment/actions_desktop.html +++ b/files/templates/component/comment/actions_desktop.html @@ -1,88 +1,80 @@ {% if v and v.admin_level >= 2 %} -Votes + Votes {% endif %} -Context - + Context + {% if v %} - - - - + + + + {% endif %} {% if c.parent_submission %} {% if v and c.author_id == v.id %} - - - + + + {% elif v and c.body %} - + {% endif %} {% endif %} {% if v and v.admin_level >= 2 and c.filter_state == 'filtered' %} - - + + {% endif %} {% if v %} - + {% endif %} diff --git a/files/templates/component/comment/replybox_comment.html b/files/templates/component/comment/replybox_comment.html index d88dd0a0e..6f9577636 100644 --- a/files/templates/component/comment/replybox_comment.html +++ b/files/templates/component/comment/replybox_comment.html @@ -1,29 +1,29 @@
-
diff --git a/files/templates/component/comment/replybox_message.html b/files/templates/component/comment/replybox_message.html index 191388d32..c3efb6ceb 100644 --- a/files/templates/component/comment/replybox_message.html +++ b/files/templates/component/comment/replybox_message.html @@ -1,16 +1,16 @@ Reply
-