Skip to content

Commit

Permalink
fix: quality checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Faraz Maqsood committed Sep 26, 2024
1 parent 02de566 commit 4de5e72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions forum/backends/mongodb/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def get_abuse_flagged_count(thread_ids: list[str]) -> dict[str, int]:
pipeline: list[dict[str, Any]] = [
{
"$match": {
"comment_thread_id": {"$in": [tid for tid in thread_ids]},
"comment_thread_id": {"$in": thread_ids},
"abuse_flaggers": {"$ne": []},
}
},
Expand Down Expand Up @@ -430,7 +430,7 @@ def get_filtered_thread_ids(
set: A set of filtered thread IDs based on the context and group ID criteria.
"""
context_query = {
"_id": {"$in": [tid for tid in thread_ids]},
"_id": {"$in": thread_ids},
"context": context,
}
context_threads = CommentThread().find(context_query)
Expand All @@ -440,7 +440,7 @@ def get_filtered_thread_ids(
return context_thread_ids

group_query = {
"_id": {"$in": [tid for tid in thread_ids]},
"_id": {"$in": thread_ids},
"$or": [
{"group_id": {"$in": group_ids}},
{"group_id": {"$exists": False}},
Expand All @@ -464,7 +464,7 @@ def get_endorsed(thread_ids: list[str]) -> dict[str, bool]:
"""
endorsed_comments = Comment().find(
{
"comment_thread_id": {"$in": [tid for tid in thread_ids]},
"comment_thread_id": {"$in": thread_ids},
"endorsed": True,
}
)
Expand Down Expand Up @@ -1034,7 +1034,7 @@ def user_to_hash(
comment_thread_ids = filter_standalone_threads(list(comments))

group_query = {
"_id": {"$in": [tid for tid in comment_thread_ids]},
"_id": {"$in": comment_thread_ids},
"$and": [
{"group_id": {"$in": specified_groups_or_global}},
{"group_id": {"$exists": False}},
Expand Down
2 changes: 1 addition & 1 deletion forum/backends/mongodb/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def insert(
"""
date = datetime.now()
comment_data = {
"_id":str(ObjectId()),
"_id": str(ObjectId()),
"votes": self.get_votes_dict(up=[], down=[]),
"visible": visible,
"abuse_flaggers": abuse_flaggers or [],
Expand Down

0 comments on commit 4de5e72

Please sign in to comment.