Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion forum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Openedx forum app.
"""

__version__ = "0.4.2"
__version__ = "0.4.3"
2 changes: 2 additions & 0 deletions forum/backends/mongodb/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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}}},
Expand Down
2 changes: 2 additions & 0 deletions forum/backends/mysql/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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(
Expand Down