element-hq / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://element-hq.github.io/synapse
GNU Affero General Public License v3.0
1.55k stars 190 forks source link

Add User ID of the person who Initiated the search, as a parameter to the callback method check_username_for_spam in spam checker ModuleAPI #16884

Open toshanmugaraj opened 9 months ago

toshanmugaraj commented 9 months ago

Description:

Currently, the callback method for check_username_for_spam does not include the user ID of the person who initiated the search as a parameter. This limitation hinders our ability to filter search result effectively and restrict user visibility based on who initiated the search.

To address this issue, we suggest adding a user ID parameter to the callback method. This will allow us to associate the spam username check results and search results with the corresponding user IDs, enabling us to implement more effective spam prevention measures and user visibility controls.

You can find the relevant code that calls the check_username_for_spam method in the user_directory.py file at the following location: user_directory.py#L160-L167.

This enhancement may require updating documentation and deprecating the old callback method.

Additionally, we would like to request the following changes:

  1. Deprecation of the original callback: Please mark the original callback method as deprecated in the documentation, but do not remove it from the codebase.2.
  2. Rename the new callback: As the original name "check_username_for_spam" does not accurately reflect the fact that a full user profile is provided, we suggest renaming the new callback to "check_user_profile_for_spam" to better align with its functionality.
anoadragon453 commented 5 months ago

This sounds reasonable to me. Note that deprecated Module API methods should be noted as such in the upgrade notes.