Skip to content

Commit

Permalink
Merge tag 'v1.46.0'
Browse files Browse the repository at this point in the history
Synapse 1.46.0 (2021-11-02)
===========================

The cause of the [performance regression affecting Synapse 1.44](matrix-org#11049) has been identified and fixed. ([\matrix-org#11177](matrix-org#11177))

Bugfixes
--------

- Fix a bug introduced in v1.46.0rc1 where URL previews of some XML documents would fail. ([\matrix-org#11196](matrix-org#11196))

Synapse 1.46.0rc1 (2021-10-27)
==============================

Features
--------

- Add support for Ubuntu 21.10 "Impish Indri". ([\matrix-org#11024](matrix-org#11024))
- Port the Password Auth Providers module interface to the new generic interface. ([\matrix-org#10548](matrix-org#10548), [\matrix-org#11180](matrix-org#11180))
- Experimental support for the thread relation defined in [MSC3440](matrix-org/matrix-spec-proposals#3440). ([\matrix-org#11088](matrix-org#11088), [\matrix-org#11181](matrix-org#11181), [\matrix-org#11192](matrix-org#11192))
- Users admin API can now also modify user type in addition to allowing it to be set on user creation. ([\matrix-org#11174](matrix-org#11174))

Bugfixes
--------

- Newly-created public rooms are now only assigned an alias if the room's creation has not been blocked by permission settings. Contributed by @AndrewFerr. ([\matrix-org#10930](matrix-org#10930))
- Fix a long-standing bug which meant that events received over federation were sometimes incorrectly accepted into the room state. ([\matrix-org#11001](matrix-org#11001), [\matrix-org#11009](matrix-org#11009), [\matrix-org#11012](matrix-org#11012))
- Fix 500 error on `/messages` when the server accumulates more than 5 backwards extremities at a given depth for a room. ([\matrix-org#11027](matrix-org#11027))
- Fix a bug where setting a user's `external_id` via the admin API returns 500 and deletes user's existing external mappings if that external ID is already mapped. ([\matrix-org#11051](matrix-org#11051))
- Fix a long-standing bug where users excluded from the user directory were added into the directory if they belonged to a room which became public or private. ([\matrix-org#11075](matrix-org#11075))
- Fix a long-standing bug when attempting to preview URLs which are in the `windows-1252` character encoding. ([\matrix-org#11077](matrix-org#11077), [\matrix-org#11089](matrix-org#11089))
- Fix broken export-data admin command and add test script checking the command to CI. ([\matrix-org#11078](matrix-org#11078))
- Show an error when timestamp in seconds is provided to the `/purge_media_cache` Admin API. ([\matrix-org#11101](matrix-org#11101))
- Fix local users who left all their rooms being removed from the user directory, even if the `search_all_users` config option was enabled. ([\matrix-org#11103](matrix-org#11103))
- Fix a bug which caused the module API's `get_user_ip_and_agents` function to always fail on workers. `get_user_ip_and_agents` was introduced in 1.44.0 and did not function correctly on worker processes at the time. ([\matrix-org#11112](matrix-org#11112))
- Identity server connection is no longer ignoring `ip_range_whitelist`. ([\matrix-org#11120](matrix-org#11120))
- Fix a bug introduced in Synapse 1.45.0 breaking the configuration file parsing script. ([\matrix-org#11145](matrix-org#11145))
- Fix a performance regression introduced in 1.44.0 which could cause client requests to time out when making large numbers of outbound requests. ([\matrix-org#11177](matrix-org#11177), [\matrix-org#11190](matrix-org#11190))
- Resolve and share `state_groups` for all [MSC2716](matrix-org/matrix-spec-proposals#2716) historical events in batch. ([\matrix-org#10975](matrix-org#10975))

Improved Documentation
----------------------

- Fix broken links relating to module API deprecation in the upgrade notes. ([\matrix-org#11069](matrix-org#11069))
- Add more information about what happens when a user is deactivated. ([\matrix-org#11083](matrix-org#11083))
- Clarify the the sample log config can be copied from the documentation without issue. ([\matrix-org#11092](matrix-org#11092))
- Update the admin API documentation with an updated list of the characters allowed in registration tokens. ([\matrix-org#11093](matrix-org#11093))
- Document Synapse's behaviour when dealing with multiple modules registering the same callbacks and/or handlers for the same HTTP endpoints. ([\matrix-org#11096](matrix-org#11096))
- Fix instances of `[example]{.title-ref}` in the upgrade documentation as a result of prior RST to Markdown conversion. ([\matrix-org#11118](matrix-org#11118))
- Document the version of Synapse each module callback was introduced in. ([\matrix-org#11132](matrix-org#11132))
- Document the version of Synapse that introduced each module API method. ([\matrix-org#11183](matrix-org#11183))

Internal Changes
----------------
- Fix spurious warnings about losing the logging context on the `ReplicationCommandHandler` when losing the replication connection. ([\matrix-org#10984](matrix-org#10984))
- Include rejected status when we log events. ([\matrix-org#11008](matrix-org#11008))
- Add some extra logging to the event persistence code. ([\matrix-org#11014](matrix-org#11014))
- Rearrange the internal workings of the incremental user directory updates. ([\matrix-org#11035](matrix-org#11035))
- Fix a long-standing bug where users excluded from the directory could still be added to the `users_who_share_private_rooms` table after a regular user joins a private room. ([\matrix-org#11143](matrix-org#11143))
- Add and improve type hints. ([\matrix-org#10972](matrix-org#10972), [\matrix-org#11055](matrix-org#11055), [\matrix-org#11066](matrix-org#11066), [\matrix-org#11076](matrix-org#11076), [\matrix-org#11095](matrix-org#11095), [\matrix-org#11109](matrix-org#11109), [\matrix-org#11121](matrix-org#11121), [\matrix-org#11146](matrix-org#11146))
- Mark the Synapse package as containing type annotations and fix export declarations so that Synapse pluggable modules may be type checked against Synapse. ([\matrix-org#11054](matrix-org#11054))
- Remove dead code from `MediaFilePaths`. ([\matrix-org#11056](matrix-org#11056))
- Be more lenient when parsing oEmbed response versions. ([\matrix-org#11065](matrix-org#11065))
- Create a separate module for the retention configuration. ([\matrix-org#11070](matrix-org#11070))
- Clean up some of the federation event authentication code for clarity. ([\matrix-org#11115](matrix-org#11115), [\matrix-org#11116](matrix-org#11116), [\matrix-org#11122](matrix-org#11122))
- Add docstrings and comments to the application service ephemeral event sending code. ([\matrix-org#11138](matrix-org#11138))
- Update the `sign_json` script to support inline configuration of the signing key. ([\matrix-org#11139](matrix-org#11139))
- Fix broken link in the docker image README. ([\matrix-org#11144](matrix-org#11144))
- Always dump logs from unit tests during CI runs. ([\matrix-org#11068](matrix-org#11068))
- Add tests for `MediaFilePaths` class. ([\matrix-org#11057](matrix-org#11057))
- Simplify the user admin API tests. ([\matrix-org#11048](matrix-org#11048))
- Add a test for the workaround introduced in [\matrix-org#11042](matrix-org#11042) concerning the behaviour of third-party rule modules and `SynapseError`s. ([\matrix-org#11071](matrix-org#11071))
  • Loading branch information
tulir committed Nov 4, 2021
2 parents 04ed203 + 2d44ee6 commit 006e2cf
Show file tree
Hide file tree
Showing 171 changed files with 5,575 additions and 2,289 deletions.
57 changes: 57 additions & 0 deletions .ci/scripts/test_export_data_command.sh
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

# Test for the export-data admin command against sqlite and postgres

set -xe
cd `dirname $0`/../..

echo "--- Install dependencies"

# Install dependencies for this test.
pip install psycopg2

# Install Synapse itself. This won't update any libraries.
pip install -e .

echo "--- Generate the signing key"

# Generate the server's signing key.
python -m synapse.app.homeserver --generate-keys -c .ci/sqlite-config.yaml

echo "--- Prepare test database"

# Make sure the SQLite3 database is using the latest schema and has no pending background update.
scripts/update_synapse_database --database-config .ci/sqlite-config.yaml --run-background-updates

# Run the export-data command on the sqlite test database
python -m synapse.app.admin_cmd -c .ci/sqlite-config.yaml export-data @anon-20191002_181700-832:localhost:8800 \
--output-directory /tmp/export_data

# Test that the output directory exists and contains the rooms directory
dir="/tmp/export_data/rooms"
if [ -d "$dir" ]; then
echo "Command successful, this test passes"
else
echo "No output directories found, the command fails against a sqlite database."
exit 1
fi

# Create the PostgreSQL database.
.ci/scripts/postgres_exec.py "CREATE DATABASE synapse"

# Port the SQLite databse to postgres so we can check command works against postgres
echo "+++ Port SQLite3 databse to postgres"
scripts/synapse_port_db --sqlite-database .ci/test_db.db --postgres-config .ci/postgres-config.yaml

# Run the export-data command on postgres database
python -m synapse.app.admin_cmd -c .ci/postgres-config.yaml export-data @anon-20191002_181700-832:localhost:8800 \
--output-directory /tmp/export_data2

# Test that the output directory exists and contains the rooms directory
dir2="/tmp/export_data2/rooms"
if [ -d "$dir2" ]; then
echo "Command successful, this test passes"
else
echo "No output directories found, the command fails against a postgres database."
exit 1
fi
35 changes: 35 additions & 0 deletions .github/workflows/tests.yml
Expand Up @@ -122,6 +122,8 @@ jobs:
SYNAPSE_POSTGRES_USER: postgres
SYNAPSE_POSTGRES_PASSWORD: postgres
- name: Dump logs
# Logs are most useful when the command fails, always include them.
if: ${{ always() }}
# Note: Dumps to workflow logs instead of using actions/upload-artifact
# This keeps logs colocated with failing jobs
# It also ignores find's exit code; this is a best effort affair
Expand All @@ -146,6 +148,8 @@ jobs:
env:
TRIAL_FLAGS: "--jobs=2"
- name: Dump logs
# Logs are most useful when the command fails, always include them.
if: ${{ always() }}
# Note: Dumps to workflow logs instead of using actions/upload-artifact
# This keeps logs colocated with failing jobs
# It also ignores find's exit code; this is a best effort affair
Expand Down Expand Up @@ -176,6 +180,8 @@ jobs:
env:
TRIAL_FLAGS: "--jobs=2"
- name: Dump logs
# Logs are most useful when the command fails, always include them.
if: ${{ always() }}
# Note: Dumps to workflow logs instead of using actions/upload-artifact
# This keeps logs colocated with failing jobs
# It also ignores find's exit code; this is a best effort affair
Expand Down Expand Up @@ -247,6 +253,35 @@ jobs:
/logs/results.tap
/logs/**/*.log*
export-data:
if: ${{ !failure() && !cancelled() }} # Allow previous steps to be skipped, but not fail
needs: [linting-done, portdb]
runs-on: ubuntu-latest
env:
TOP: ${{ github.workspace }}

services:
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: "postgres"
POSTGRES_INITDB_ARGS: "--lc-collate C --lc-ctype C --encoding UTF8"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- run: sudo apt-get -qq install xmlsec1
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: .ci/scripts/test_export_data_command.sh

portdb:
if: ${{ !failure() && !cancelled() }} # Allow previous steps to be skipped, but not fail
needs: linting-done
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/twisted_trunk.yml
Expand Up @@ -33,6 +33,8 @@ jobs:
TRIAL_FLAGS: "--jobs=2"

- name: Dump logs
# Logs are most useful when the command fails, always include them.
if: ${{ always() }}
# Note: Dumps to workflow logs instead of using actions/upload-artifact
# This keeps logs colocated with failing jobs
# It also ignores find's exit code; this is a best effort affair
Expand Down
77 changes: 77 additions & 0 deletions CHANGES.md
@@ -1,3 +1,80 @@
Synapse 1.46.0 (2021-11-02)
===========================

The cause of the [performance regression affecting Synapse 1.44](https://github.com/matrix-org/synapse/issues/11049) has been identified and fixed. ([\#11177](https://github.com/matrix-org/synapse/issues/11177))

Bugfixes
--------

- Fix a bug introduced in v1.46.0rc1 where URL previews of some XML documents would fail. ([\#11196](https://github.com/matrix-org/synapse/issues/11196))


Synapse 1.46.0rc1 (2021-10-27)
==============================

Features
--------

- Add support for Ubuntu 21.10 "Impish Indri". ([\#11024](https://github.com/matrix-org/synapse/issues/11024))
- Port the Password Auth Providers module interface to the new generic interface. ([\#10548](https://github.com/matrix-org/synapse/issues/10548), [\#11180](https://github.com/matrix-org/synapse/issues/11180))
- Experimental support for the thread relation defined in [MSC3440](https://github.com/matrix-org/matrix-doc/pull/3440). ([\#11088](https://github.com/matrix-org/synapse/issues/11088), [\#11181](https://github.com/matrix-org/synapse/issues/11181), [\#11192](https://github.com/matrix-org/synapse/issues/11192))
- Users admin API can now also modify user type in addition to allowing it to be set on user creation. ([\#11174](https://github.com/matrix-org/synapse/issues/11174))


Bugfixes
--------

- Newly-created public rooms are now only assigned an alias if the room's creation has not been blocked by permission settings. Contributed by @AndrewFerr. ([\#10930](https://github.com/matrix-org/synapse/issues/10930))
- Fix a long-standing bug which meant that events received over federation were sometimes incorrectly accepted into the room state. ([\#11001](https://github.com/matrix-org/synapse/issues/11001), [\#11009](https://github.com/matrix-org/synapse/issues/11009), [\#11012](https://github.com/matrix-org/synapse/issues/11012))
- Fix 500 error on `/messages` when the server accumulates more than 5 backwards extremities at a given depth for a room. ([\#11027](https://github.com/matrix-org/synapse/issues/11027))
- Fix a bug where setting a user's `external_id` via the admin API returns 500 and deletes user's existing external mappings if that external ID is already mapped. ([\#11051](https://github.com/matrix-org/synapse/issues/11051))
- Fix a long-standing bug where users excluded from the user directory were added into the directory if they belonged to a room which became public or private. ([\#11075](https://github.com/matrix-org/synapse/issues/11075))
- Fix a long-standing bug when attempting to preview URLs which are in the `windows-1252` character encoding. ([\#11077](https://github.com/matrix-org/synapse/issues/11077), [\#11089](https://github.com/matrix-org/synapse/issues/11089))
- Fix broken export-data admin command and add test script checking the command to CI. ([\#11078](https://github.com/matrix-org/synapse/issues/11078))
- Show an error when timestamp in seconds is provided to the `/purge_media_cache` Admin API. ([\#11101](https://github.com/matrix-org/synapse/issues/11101))
- Fix local users who left all their rooms being removed from the user directory, even if the `search_all_users` config option was enabled. ([\#11103](https://github.com/matrix-org/synapse/issues/11103))
- Fix a bug which caused the module API's `get_user_ip_and_agents` function to always fail on workers. `get_user_ip_and_agents` was introduced in 1.44.0 and did not function correctly on worker processes at the time. ([\#11112](https://github.com/matrix-org/synapse/issues/11112))
- Identity server connection is no longer ignoring `ip_range_whitelist`. ([\#11120](https://github.com/matrix-org/synapse/issues/11120))
- Fix a bug introduced in Synapse 1.45.0 breaking the configuration file parsing script. ([\#11145](https://github.com/matrix-org/synapse/issues/11145))
- Fix a performance regression introduced in 1.44.0 which could cause client requests to time out when making large numbers of outbound requests. ([\#11177](https://github.com/matrix-org/synapse/issues/11177), [\#11190](https://github.com/matrix-org/synapse/issues/11190))
- Resolve and share `state_groups` for all [MSC2716](https://github.com/matrix-org/matrix-doc/pull/2716) historical events in batch. ([\#10975](https://github.com/matrix-org/synapse/issues/10975))


Improved Documentation
----------------------

- Fix broken links relating to module API deprecation in the upgrade notes. ([\#11069](https://github.com/matrix-org/synapse/issues/11069))
- Add more information about what happens when a user is deactivated. ([\#11083](https://github.com/matrix-org/synapse/issues/11083))
- Clarify the the sample log config can be copied from the documentation without issue. ([\#11092](https://github.com/matrix-org/synapse/issues/11092))
- Update the admin API documentation with an updated list of the characters allowed in registration tokens. ([\#11093](https://github.com/matrix-org/synapse/issues/11093))
- Document Synapse's behaviour when dealing with multiple modules registering the same callbacks and/or handlers for the same HTTP endpoints. ([\#11096](https://github.com/matrix-org/synapse/issues/11096))
- Fix instances of `[example]{.title-ref}` in the upgrade documentation as a result of prior RST to Markdown conversion. ([\#11118](https://github.com/matrix-org/synapse/issues/11118))
- Document the version of Synapse each module callback was introduced in. ([\#11132](https://github.com/matrix-org/synapse/issues/11132))
- Document the version of Synapse that introduced each module API method. ([\#11183](https://github.com/matrix-org/synapse/issues/11183))


Internal Changes
----------------
- Fix spurious warnings about losing the logging context on the `ReplicationCommandHandler` when losing the replication connection. ([\#10984](https://github.com/matrix-org/synapse/issues/10984))
- Include rejected status when we log events. ([\#11008](https://github.com/matrix-org/synapse/issues/11008))
- Add some extra logging to the event persistence code. ([\#11014](https://github.com/matrix-org/synapse/issues/11014))
- Rearrange the internal workings of the incremental user directory updates. ([\#11035](https://github.com/matrix-org/synapse/issues/11035))
- Fix a long-standing bug where users excluded from the directory could still be added to the `users_who_share_private_rooms` table after a regular user joins a private room. ([\#11143](https://github.com/matrix-org/synapse/issues/11143))
- Add and improve type hints. ([\#10972](https://github.com/matrix-org/synapse/issues/10972), [\#11055](https://github.com/matrix-org/synapse/issues/11055), [\#11066](https://github.com/matrix-org/synapse/issues/11066), [\#11076](https://github.com/matrix-org/synapse/issues/11076), [\#11095](https://github.com/matrix-org/synapse/issues/11095), [\#11109](https://github.com/matrix-org/synapse/issues/11109), [\#11121](https://github.com/matrix-org/synapse/issues/11121), [\#11146](https://github.com/matrix-org/synapse/issues/11146))
- Mark the Synapse package as containing type annotations and fix export declarations so that Synapse pluggable modules may be type checked against Synapse. ([\#11054](https://github.com/matrix-org/synapse/issues/11054))
- Remove dead code from `MediaFilePaths`. ([\#11056](https://github.com/matrix-org/synapse/issues/11056))
- Be more lenient when parsing oEmbed response versions. ([\#11065](https://github.com/matrix-org/synapse/issues/11065))
- Create a separate module for the retention configuration. ([\#11070](https://github.com/matrix-org/synapse/issues/11070))
- Clean up some of the federation event authentication code for clarity. ([\#11115](https://github.com/matrix-org/synapse/issues/11115), [\#11116](https://github.com/matrix-org/synapse/issues/11116), [\#11122](https://github.com/matrix-org/synapse/issues/11122))
- Add docstrings and comments to the application service ephemeral event sending code. ([\#11138](https://github.com/matrix-org/synapse/issues/11138))
- Update the `sign_json` script to support inline configuration of the signing key. ([\#11139](https://github.com/matrix-org/synapse/issues/11139))
- Fix broken link in the docker image README. ([\#11144](https://github.com/matrix-org/synapse/issues/11144))
- Always dump logs from unit tests during CI runs. ([\#11068](https://github.com/matrix-org/synapse/issues/11068))
- Add tests for `MediaFilePaths` class. ([\#11057](https://github.com/matrix-org/synapse/issues/11057))
- Simplify the user admin API tests. ([\#11048](https://github.com/matrix-org/synapse/issues/11048))
- Add a test for the workaround introduced in [\#11042](https://github.com/matrix-org/synapse/pull/11042) concerning the behaviour of third-party rule modules and `SynapseError`s. ([\#11071](https://github.com/matrix-org/synapse/issues/11071))


Synapse 1.45.1 (2021-10-20)
===========================

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -8,6 +8,7 @@ include demo/demo.tls.dh
include demo/*.py
include demo/*.sh

include synapse/py.typed
recursive-include synapse/storage *.sql
recursive-include synapse/storage *.sql.postgres
recursive-include synapse/storage *.sql.sqlite
Expand Down
16 changes: 16 additions & 0 deletions debian/changelog
@@ -1,3 +1,19 @@
matrix-synapse-py3 (1.46.0) stable; urgency=medium

[ Richard van der Hoff ]
* Compress debs with xz, to fix incompatibility of impish debs with reprepro.

[ Synapse Packaging team ]
* New synapse release 1.46.0.

-- Synapse Packaging team <packages@matrix.org> Tue, 02 Nov 2021 13:22:53 +0000

matrix-synapse-py3 (1.46.0~rc1) stable; urgency=medium

* New synapse release 1.46.0~rc1.

-- Synapse Packaging team <packages@matrix.org> Tue, 26 Oct 2021 14:04:04 +0100

matrix-synapse-py3 (1.45.1) stable; urgency=medium

* New synapse release 1.45.1.
Expand Down
6 changes: 6 additions & 0 deletions debian/rules
Expand Up @@ -51,5 +51,11 @@ override_dh_shlibdeps:
override_dh_virtualenv:
./debian/build_virtualenv

override_dh_builddeb:
# force the compression to xzip, to stop dpkg-deb on impish defaulting to zstd
# (which requires reprepro 5.3.0-1.3, which is currently only in 'experimental' in Debian:
# https://metadata.ftp-master.debian.org/changelogs/main/r/reprepro/reprepro_5.3.0-1.3_changelog)
dh_builddeb -- -Zxz

%:
dh $@ --with python-virtualenv
3 changes: 2 additions & 1 deletion docker/README.md
Expand Up @@ -226,4 +226,5 @@ healthcheck:
## Using jemalloc

Jemalloc is embedded in the image and will be used instead of the default allocator.
You can read about jemalloc by reading the Synapse [README](../README.rst).
You can read about jemalloc by reading the Synapse
[README](https://github.com/matrix-org/synapse/blob/HEAD/README.rst#help-synapse-is-slow-and-eats-all-my-ram-cpu).
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Expand Up @@ -43,6 +43,7 @@
- [Third-party rules callbacks](modules/third_party_rules_callbacks.md)
- [Presence router callbacks](modules/presence_router_callbacks.md)
- [Account validity callbacks](modules/account_validity_callbacks.md)
- [Password auth provider callbacks](modules/password_auth_provider_callbacks.md)
- [Porting a legacy module to the new interface](modules/porting_legacy_module.md)
- [Workers](workers.md)
- [Using `synctl` with Workers](synctl_workers.md)
Expand Down
6 changes: 3 additions & 3 deletions docs/admin_api/media_admin_api.md
Expand Up @@ -257,9 +257,9 @@ POST /_synapse/admin/v1/media/<server_name>/delete?before_ts=<before_ts>
URL Parameters

* `server_name`: string - The name of your local server (e.g `matrix.org`).
* `before_ts`: string representing a positive integer - Unix timestamp in ms.
* `before_ts`: string representing a positive integer - Unix timestamp in milliseconds.
Files that were last used before this timestamp will be deleted. It is the timestamp of
last access and not the timestamp creation.
last access, not the timestamp when the file was created.
* `size_gt`: Optional - string representing a positive integer - Size of the media in bytes.
Files that are larger will be deleted. Defaults to `0`.
* `keep_profiles`: Optional - string representing a boolean - Switch to also delete files
Expand Down Expand Up @@ -302,7 +302,7 @@ POST /_synapse/admin/v1/purge_media_cache?before_ts=<unix_timestamp_in_ms>

URL Parameters

* `unix_timestamp_in_ms`: string representing a positive integer - Unix timestamp in ms.
* `unix_timestamp_in_ms`: string representing a positive integer - Unix timestamp in milliseconds.
All cached media that was last accessed before this timestamp will be removed.

Response:
Expand Down
19 changes: 17 additions & 2 deletions docs/admin_api/user_admin_api.md
Expand Up @@ -50,7 +50,8 @@ It returns a JSON body like the following:
"auth_provider": "<provider2>",
"external_id": "<user_id_provider_2>"
}
]
],
"user_type": null
}
```

Expand Down Expand Up @@ -97,7 +98,8 @@ with a body of:
],
"avatar_url": "<avatar_url>",
"admin": false,
"deactivated": false
"deactivated": false,
"user_type": null
}
```

Expand Down Expand Up @@ -135,6 +137,9 @@ Body parameters:
unchanged on existing accounts and set to `false` for new accounts.
A user cannot be erased by deactivating with this API. For details on
deactivating users see [Deactivate Account](#deactivate-account).
- `user_type` - string or null, optional. If provided, the user type will be
adjusted. If `null` given, the user type will be cleared. Other
allowed options are: `bot` and `support`.

If the user already exists then optional parameters default to the current value.

Expand Down Expand Up @@ -341,6 +346,7 @@ The following actions are performed when deactivating an user:
- Remove all 3PIDs from the homeserver
- Delete all devices and E2EE keys
- Delete all access tokens
- Delete all pushers
- Delete the password hash
- Removal from all rooms the user is a member of
- Remove the user from the user directory
Expand All @@ -354,6 +360,15 @@ is set to `true`:
- Remove the user's avatar URL
- Mark the user as erased

The following actions are **NOT** performed. The list may be incomplete.

- Remove mappings of SSO IDs
- [Delete media uploaded](#delete-media-uploaded-by-a-user) by user (included avatar images)
- Delete sent and received messages
- Delete E2E cross-signing keys
- Remove the user's creation (registration) timestamp
- [Remove rate limit overrides](#override-ratelimiting-for-users)
- Remove from monthly active users

## Reset password

Expand Down
11 changes: 11 additions & 0 deletions docs/modules/account_validity_callbacks.md
Expand Up @@ -9,6 +9,8 @@ The available account validity callbacks are:

### `is_user_expired`

_First introduced in Synapse v1.39.0_

```python
async def is_user_expired(user: str) -> Optional[bool]
```
Expand All @@ -22,12 +24,21 @@ If the module returns `True`, the current request will be denied with the error
`ORG_MATRIX_EXPIRED_ACCOUNT` and the HTTP status code 403. Note that this doesn't
invalidate the user's access token.

If multiple modules implement this callback, they will be considered in order. If a
callback returns `None`, Synapse falls through to the next one. The value of the first
callback that does not return `None` will be used. If this happens, Synapse will not call
any of the subsequent implementations of this callback.

### `on_user_registration`

_First introduced in Synapse v1.39.0_

```python
async def on_user_registration(user: str) -> None
```

Called after successfully registering a user, in case the module needs to perform extra
operations to keep track of them. (e.g. add them to a database table). The user is
represented by their Matrix user ID.

If multiple modules implement this callback, Synapse runs them all in order.

0 comments on commit 006e2cf

Please sign in to comment.