From 6fed88bafbb1a016e2855191a513e97d6c9714a3 Mon Sep 17 00:00:00 2001 From: Pavel Kvach Date: Sun, 28 Apr 2024 01:03:50 +0300 Subject: [PATCH] admin: Add support for comment search by Thread URL in admin interface See: - https://github.com/isso-comments/isso/issues/642 - https://github.com/isso-comments/isso/pull/1000 --- isso/db/comments.py | 5 ++++- isso/templates/admin.html | 6 +++--- isso/views/comments.py | 38 +++++++++++++++++++++++++++++--------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/isso/db/comments.py b/isso/db/comments.py index 6fa911bd..f2aa4fff 100644 --- a/isso/db/comments.py +++ b/isso/db/comments.py @@ -167,7 +167,7 @@ def count_modes(self): return dict(comment_count) def fetchall(self, mode=5, after=0, parent='any', order_by='id', - limit=100, page=0, asc=1, comment_id=None): + limit=100, page=0, asc=1, comment_id=None, thread_uri=None): """ Return comments for admin with :param:`mode`. """ @@ -187,6 +187,9 @@ def fetchall(self, mode=5, after=0, parent='any', order_by='id', if comment_id: sql.append('comments.id = ? ') sql_args = [comment_id] + elif thread_uri: + sql.append('threads.uri = ? ') + sql_args = [thread_uri] else: sql.append('comments.mode = ? ') sql_args = [mode] diff --git a/isso/templates/admin.html b/isso/templates/admin.html index a6220301..86c61c65 100644 --- a/isso/templates/admin.html +++ b/isso/templates/admin.html @@ -74,9 +74,9 @@

Administration