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

User directory should handle changes in user types #11185

Open
5 tasks
DMRobertson opened this issue Oct 26, 2021 · 5 comments
Open
5 tasks

User directory should handle changes in user types #11185

DMRobertson opened this issue Oct 26, 2021 · 5 comments
Labels
A-User-Directory P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@DMRobertson
Copy link
Contributor

DMRobertson commented Oct 26, 2021

#11174 introduces an admin API to make a user become a support user. Support users are excluded from the user directory, so doing this should remove the user from the directory. We already have to do something similar when deactivating a user. (But note: we don't update the room sharing tables when _re_activating a user, because deactivating them removes them from all rooms.)

Rough implementation:

  • Call UserDirectoryHandler.handle_local_user_deactivated if the user type changes to support
  • Rename that method to something more appropriate, e.g. remove_from_directory
  • If the user type changes from support to normal, call a new method on the UserDirectoryHandler. Say restore_to_directory
    • That method should call update_profile_in_user_dir on the store
    • and then update the room sharing tables. I think that's a loop over their rooms which calls _track_user_joined_room.
@DMRobertson DMRobertson added S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches labels Oct 26, 2021
@DMRobertson DMRobertson changed the title User directory should handle changes in user tpes User directory should handle changes in user types Oct 26, 2021
@babolivier
Copy link
Contributor

Ah good catch!

@pierre-alain-b
Copy link

Hi there, as of now, when a user is deactivated, it is still visible in the suggestions of Element Web/Desktop which, if I understand correctly, queries Synapse API on https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-user-directory-search
Would it be possible for Synapse to return the status of the user (at least activated/deactivated) so that deactivated users are not shown?

@pierre-alain-b
Copy link

Shouldn't there be a check that the user is not deactivated?

That said, I see that in the user_directory table we have no such field...

@pierre-alain-b
Copy link

In fact it says here https://github.com/matrix-org/synapse/blob/ea20937084903864865f76e22f67d27729f2d6dc/docs/user_directory.md that deactivated users are not kept in this table. But I have a different behavior on my instance so I am a bit lost here...

@DMRobertson
Copy link
Contributor Author

Hi @pierre-alain-b. This issue isn't really the right place for this. Let's discuss this in #12431.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-User-Directory P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

4 participants