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

Commit

Permalink
Merge pull request #2803 from matrix-org/matthew/fix-userdir-sql
Browse files Browse the repository at this point in the history
fix SQL when searching all users
  • Loading branch information
ara4n authored Jan 17, 2018
2 parents 8716eb4 + 2d9ab53 commit 06db5c4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions synapse/storage/user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,13 @@ def search_user_dir(self, user_id, search_term, limit):
"""

if self.hs.config.user_directory_search_all_users:
join_clause = ""
where_clause = "?<>''" # naughty hack to keep the same number of binds
# dummy to keep the number of binds & aliases the same
join_clause = """
LEFT JOIN (
SELECT NULL as user_id WHERE NULL = ?
) AS s USING (user_id)"
"""
where_clause = ""
else:
join_clause = """
LEFT JOIN users_in_public_rooms AS p USING (user_id)
Expand Down

0 comments on commit 06db5c4

Please sign in to comment.