This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Define a new Synapse module that can manipulate user directory search results #9259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR creates a new Synapse module type that is intended to interact with the user directory. In its current state, the only method that can be overridden is
get_search_query_ordering
which, given a database type, will return SQL that defines how user directory search results should be ordered.The motivation for this is that DINUM would like to be able to return users with a specific string in their displayname higher than other results. It could potentially be used by others to manipulate search results in whichever way they wish, though admittedly in a limited way currently. There is potential to expand this module to manipulate other areas of the user directory search in the future though.
DINUM's instance of the module is located here, and should be considered during review.
Note: I'm aware that having a module pass direct SQL to Synapse is a bit dangerous, however so are the abilities of many other modules. Modules aren't meant to be installed willy-nilly.
I'm also aware that it's a bit gross to request part of an SQL query from a module. I didn't want to allow the module to manipulate the return values from the query however, as that would require a much more generic method of processing the results of the query.
Reviewable commit-by-commit.