element-hq / element-hq/synapse

User directory should handle changes in user types

Open
#11,185 0 comments 0 reactions 0 assignees View on GitHub
A-User-Directory P4 S-Tolerable T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#11185](https://github.com/matrix-org/synapse/issues/11185).

---

#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`.

Contributor guide

Open the contributing guide

Research direction

Read UserDirectoryHandler.handle_local_user_deactivated and the store's update_profile_in_user_dir, then trace the user-type change introduced by #11174. Done means support transitions remove users, normal transitions restore profiles and room-sharing entries, with existing deactivation behavior preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.