feat: add shadow ban support for users (#270)#822
Conversation
Add UI controls to view and toggle shadow banning of users via the Synapse Admin API. Shadow banned users can send messages but they won't be delivered to anyone. - Add shadow_banned boolean mapping in user data provider - Add shadow_banned column in user list - Add shadow_banned filter toggle in user list - Add shadow_banned toggle with helper text in user edit form - Add translations for all 7 languages (en, de, fr, it, ru, fa, zh) - Add tests for data mapping, list column, filter, and edit toggle
There was a problem hiding this comment.
Pull request overview
This PR adds shadow ban support to the admin UI by surfacing Synapse’s shadow_banned user flag in the data provider and user management screens, plus translations and related tests (per #270).
Changes:
- Map
shadow_bannedfrom Synapse user payloads into the UI record model. - Add
shadow_bannedcolumn, list filter toggle, and edit-form toggle (with helper text) to the Users resource. - Add i18n strings for 7 locales and extend/adjust tests for the new UI/data mapping.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/synapse/dataProvider.ts | Adds shadow_banned boolean mapping for users. |
| src/synapse/dataProvider.test.ts | Extends mapping tests to cover shadow_banned and reformats several expectations. |
| src/resources/users.tsx | Adds shadow_banned filter, column, and edit toggle. |
| src/resources/users.test.tsx | Adds UI tests ensuring the new column/filter/toggle render. |
| src/i18n/en.ts | Adds shadow_banned field label, list filter label, and helper text. |
| src/i18n/de.ts | Same as above (German). |
| src/i18n/fr.ts | Same as above (French). |
| src/i18n/it.ts | Same as above (Italian). |
| src/i18n/ru.ts | Same as above (Russian). |
| src/i18n/fa.ts | Same as above (Persian). |
| src/i18n/zh.ts | Same as above (Chinese). |
| src/i18n/index.d.ts | Updates translation message typings for new keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const userFilters = [ | ||
| <SearchInput source="name" alwaysOn />, | ||
| <BooleanInput source="guests" alwaysOn />, | ||
| <BooleanInput label="resources.users.fields.show_deactivated" source="deactivated" alwaysOn />, | ||
| <BooleanInput label="resources.users.fields.show_locked" source="locked" alwaysOn />, | ||
| <BooleanInput label="resources.users.fields.show_shadow_banned" source="shadow_banned" alwaysOn />, | ||
| ]; | ||
|
|
||
| const UserBulkActionButtons = () => ( | ||
| <> | ||
| <ServerNoticeBulkButton /> | ||
| <BulkDeleteButton | ||
| label="resources.users.action.erase" | ||
| confirmTitle="resources.users.helper.erase" | ||
| mutationMode="pessimistic" | ||
| /> | ||
| </> | ||
| ); | ||
|
|
||
| export const UserList = (props: ListProps) => ( | ||
| <List | ||
| {...props} | ||
| filters={userFilters} | ||
| filterDefaultValues={{ guests: true, deactivated: false, locked: false }} | ||
| filterDefaultValues={{ guests: true, deactivated: false, locked: false, shadow_banned: false }} | ||
| sort={{ field: "name", order: "ASC" }} | ||
| actions={<UserListActions />} |
There was a problem hiding this comment.
The new shadow_banned Boolean filter is wired into the Users list UI (and given a default), but the data provider's getList query builder does not currently include params.filter.shadow_banned in the request query. As a result, toggling this filter (and the default value) will have no effect on API requests. Please plumb shadow_banned through getList (and add/adjust a test asserting the query string includes it).
This PR adds UI controls to view and toggle shadow banning of users via the Synapse Admin API. Shadow banned users can send messages but they won't be delivered to anyone.
Closes #270.
Cheers & greets!