Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions comments/services/spam_detection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from typing import cast

from comments.models import Comment
from posts.models import Post
from users.models import User, UserSpamActivity
from users.services.spam_detection import check_and_handle_content_spam
from utils.frontend import build_frontend_url
from utils.frontend import build_frontend_url, build_post_url


def check_and_handle_comment_spam(author: User, comment: Comment) -> bool:
Expand All @@ -16,8 +19,8 @@ def check_and_handle_comment_spam(author: User, comment: Comment) -> bool:
f"/admin/comments/comment/{comment.id}/change/"
)

content_frontend_url = build_frontend_url(
f"/questions/{comment.on_post.id}/#comment-{comment.id}"
content_frontend_url = (
f"{build_post_url(cast(Post, comment.on_post))}#comment-{comment.id}"
)

return check_and_handle_content_spam(
Expand Down
Loading