Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Stop using cursor_to_dict in user_directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Oct 25, 2023
1 parent 3190844 commit 2f45b36
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions synapse/storage/databases/main/user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,15 +1145,19 @@ async def search_user_dir(
raise Exception("Unrecognized database engine")

results = cast(
List[UserProfile],
await self.db_pool.execute(
"search_user_dir", self.db_pool.cursor_to_dict, sql, *args
),
List[Tuple[str, Optional[str], Optional[str]]],
await self.db_pool.execute("search_user_dir", None, sql, *args),
)

limited = len(results) > limit

return {"limited": limited, "results": results[0:limit]}
return {
"limited": limited,
"results": [
{"user_id": r[0], "display_name": r[1], "avatar_url": r[2]}
for r in results[0:limit]
],
}


def _filter_text_for_index(text: str) -> str:
Expand Down

0 comments on commit 2f45b36

Please sign in to comment.