diff --git a/forum/__init__.py b/forum/__init__.py index 1257036d..15fb549a 100644 --- a/forum/__init__.py +++ b/forum/__init__.py @@ -2,4 +2,4 @@ Openedx forum app. """ -__version__ = "0.4.2" +__version__ = "0.4.3" diff --git a/forum/backends/mongodb/api.py b/forum/backends/mongodb/api.py index bcaa851c..3bec9249 100644 --- a/forum/backends/mongodb/api.py +++ b/forum/backends/mongodb/api.py @@ -411,6 +411,7 @@ def handle_pin_unpin_thread_request( def get_abuse_flagged_count(thread_ids: list[str]) -> dict[str, int]: """ Retrieves the count of abuse-flagged comments for each thread in the provided list of thread IDs. + Only counts non-deleted comments. Args: thread_ids (list[str]): List of thread IDs to check for abuse flags. @@ -423,6 +424,7 @@ def get_abuse_flagged_count(thread_ids: list[str]) -> dict[str, int]: "$match": { "comment_thread_id": {"$in": [ObjectId(tid) for tid in thread_ids]}, "abuse_flaggers": {"$ne": []}, + "is_deleted": {"$ne": True}, } }, {"$group": {"_id": "$comment_thread_id", "flagged_count": {"$sum": 1}}}, diff --git a/forum/backends/mysql/api.py b/forum/backends/mysql/api.py index f2b4bb7a..ca3d8524 100644 --- a/forum/backends/mysql/api.py +++ b/forum/backends/mysql/api.py @@ -397,6 +397,7 @@ def handle_pin_unpin_thread_request( def get_abuse_flagged_count(thread_ids: list[str]) -> dict[str, int]: """ Retrieves the count of abuse-flagged comments for each thread in the provided list of thread IDs. + Only counts non-deleted comments. Args: thread_ids (list[str]): List of thread IDs to check for abuse flags. @@ -417,6 +418,7 @@ def get_abuse_flagged_count(thread_ids: list[str]) -> dict[str, int]: abuse_flagged_comments = ( Comment.objects.filter( comment_thread__pk__in=thread_ids, + is_deleted=False, ) .annotate( abuse_flaggers_count=Subquery(