diff options
author | HombreLaser <sebastian-440@live.com> | 2024-02-24 17:12:34 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2024-02-24 17:12:34 -0600 |
commit | a0ff547c4bd4361f60baf2d82d511a291b5996ff (patch) | |
tree | 99d99ee7c27a7f28d44f74735327027099a25fc9 /src | |
parent | 4aa78f692bc4346a7a565cdedae9acd1cd1e75dc (diff) |
Improve comments rendering
Diffstat (limited to 'src')
-rw-r--r-- | src/controllers/replies_controller.py | 6 | ||||
-rw-r--r-- | src/lib/blacklist_matcher.py | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/controllers/replies_controller.py b/src/controllers/replies_controller.py index bd47a44..6713e26 100644 --- a/src/controllers/replies_controller.py +++ b/src/controllers/replies_controller.py @@ -12,7 +12,9 @@ comments_query = CommentsQuery() @replies_blueprint.get('/api/comments/<int:comment_id>/replies') def index(comment_id): - return render_template('replies/index.jinja', page=comments_query.replies_of(comment_id)) + comment = db.get_or_404(Comment, comment_id) + + return render_template('replies/index.jinja', page=comments_query.replies_of(comment.id), comment=comment) @replies_blueprint.get('/api/replies/new') @@ -28,4 +30,4 @@ def create(comment_id): if status_code != 200: abort(status_code) - return render_template('comments/index.jinja') + return render_template('comments/index.jinja', page=comments_query.replies_of(comment_id)) diff --git a/src/lib/blacklist_matcher.py b/src/lib/blacklist_matcher.py index 0f28953..4618792 100644 --- a/src/lib/blacklist_matcher.py +++ b/src/lib/blacklist_matcher.py @@ -6,6 +6,9 @@ from config import user_config def contains_forbidden_term(comment): matcher = build_matcher() + if comment is None: + return False + return matcher.search(comment) is not None |