Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
kirgrim committed Apr 28, 2024
1 parent 2fa1057 commit e31af2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion chat_server/sio/handlers/user_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def user_message(sid, data):
cid_data = MongoDocumentsAPI.CHATS.get_chat(
search_str=data["cid"],
column_identifiers=["_id"],
requested_user_id=data["userId"],
requested_user_id=data["userID"],
)
if not cid_data:
msg = "Shouting to non-existent conversation, skipping further processing"
Expand Down
7 changes: 1 addition & 6 deletions utils/database_utils/mongo_utils/queries/dao/chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ def get_chat(
search_str: list | str,
column_identifiers: List[str] = None,
allow_regex_search: bool = False,
include_private: bool = False,
requested_user_id: str = None,
) -> dict | None:
chats = self.get_chats(
search_str=search_str,
column_identifiers=column_identifiers,
allow_regex_search=allow_regex_search,
include_private=include_private,
requested_user_id=requested_user_id,
limit=1,
)
Expand All @@ -70,7 +68,6 @@ def get_chats(
limit: int,
column_identifiers: List[str] = None,
allow_regex_search: bool = False,
include_private: bool = False,
requested_user_id: str = None,
) -> Union[None, dict]:
"""
Expand All @@ -79,22 +76,20 @@ def get_chats(
:param column_identifiers: desired column identifiers to look up
:param limit: limit found conversations
:param allow_regex_search: to allow search for matching entries that CONTAIN :param search_str
:param include_private: to include private conversations (defaults to False)
:param requested_user_id: id of the requested user (defaults to None) - used to find owned private conversations
"""
filters = self._create_matching_chat_filters(
lst_search_substr=search_str,
query_attributes=column_identifiers,
regex_search=allow_regex_search,
)
if include_private:
if requested_user_id:
filters += self._create_privacy_filters(requested_user_id)

chats = self.list_items(
filters=filters,
limit=limit,
result_as_cursor=False,
result_filters={"limit": limit},
)
for chat in chats:
chat["_id"] = str(chat["_id"])
Expand Down

0 comments on commit e31af2a

Please sign in to comment.