summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.md91
-rw-r--r--changelog.d/8756.feature1
-rw-r--r--changelog.d/8802.doc1
-rw-r--r--changelog.d/8821.bugfix1
-rw-r--r--changelog.d/8827.bugfix1
-rw-r--r--changelog.d/8829.removal1
-rw-r--r--changelog.d/8837.bugfix1
-rw-r--r--changelog.d/8839.doc1
-rw-r--r--changelog.d/8853.feature1
-rw-r--r--changelog.d/8856.misc1
-rw-r--r--changelog.d/8858.bugfix1
-rw-r--r--changelog.d/8861.misc1
-rw-r--r--changelog.d/8862.bugfix1
-rw-r--r--changelog.d/8864.misc1
-rw-r--r--changelog.d/8865.bugfix1
-rw-r--r--changelog.d/8867.bugfix1
-rw-r--r--changelog.d/8870.bugfix1
-rw-r--r--changelog.d/8872.bugfix1
-rw-r--r--changelog.d/8873.doc1
-rw-r--r--changelog.d/8874.feature1
-rw-r--r--changelog.d/8879.misc1
-rw-r--r--changelog.d/8880.misc1
-rw-r--r--changelog.d/8881.misc1
-rw-r--r--changelog.d/8882.misc1
-rw-r--r--changelog.d/8883.bugfix1
-rw-r--r--changelog.d/8886.feature1
-rw-r--r--changelog.d/8887.feature1
-rw-r--r--changelog.d/8890.feature1
-rw-r--r--changelog.d/8891.doc1
-rw-r--r--changelog.d/8897.feature1
-rw-r--r--changelog.d/8900.feature1
-rw-r--r--changelog.d/8901.misc1
-rw-r--r--changelog.d/8905.misc1
-rw-r--r--changelog.d/8906.misc1
-rw-r--r--changelog.d/8909.misc1
-rw-r--r--changelog.d/8911.feature1
-rw-r--r--changelog.d/8916.misc1
-rw-r--r--changelog.d/8918.bugfix1
-rw-r--r--changelog.d/8920.bugfix1
-rw-r--r--changelog.d/8921.bugfix1
-rw-r--r--changelog.d/8929.misc1
-rw-r--r--changelog.d/8930.feature1
-rw-r--r--changelog.d/8931.feature1
-rw-r--r--changelog.d/8933.bugfix1
-rw-r--r--changelog.d/8935.misc1
-rw-r--r--changelog.d/8937.bugfix1
-rw-r--r--changelog.d/8938.feature1
-rw-r--r--changelog.d/8940.misc1
-rw-r--r--changelog.d/8941.feature1
-rw-r--r--changelog.d/8942.feature1
-rw-r--r--changelog.d/8943.misc1
-rw-r--r--changelog.d/8945.bugfix1
-rw-r--r--changelog.d/8946.misc1
-rw-r--r--changelog.d/8950.misc1
-rw-r--r--changelog.d/8951.feature1
-rw-r--r--changelog.d/8952.misc1
-rw-r--r--changelog.d/8954.feature1
-rw-r--r--changelog.d/8958.misc1
-rw-r--r--changelog.d/8959.bugfix1
-rw-r--r--changelog.d/8962.bugfix1
-rw-r--r--changelog.d/8963.misc1
-rw-r--r--changelog.d/8964.bugfix1
-rw-r--r--changelog.d/8965.bugfix1
-rw-r--r--changelog.d/8970.feature1
-rw-r--r--changelog.d/8971.bugfix1
-rw-r--r--changelog.d/8973.misc1
-rw-r--r--changelog.d/8975.bugfix1
-rw-r--r--changelog.d/8977.bugfix1
-rw-r--r--changelog.d/8979.misc1
-rw-r--r--changelog.d/8980.misc1
-rw-r--r--changelog.d/8986.misc1
-rw-r--r--changelog.d/8987.doc1
-rw-r--r--changelog.d/8992.doc1
-rw-r--r--changelog.d/8994.feature1
-rw-r--r--changelog.d/8998.misc1
-rw-r--r--changelog.d/8999.misc1
-rw-r--r--changelog.d/9002.doc1
-rw-r--r--mypy.ini2
-rw-r--r--synapse/__init__.py2
-rw-r--r--synapse/handlers/receipts.py30
-rw-r--r--synapse/handlers/user_directory.py63
-rw-r--r--synapse/push/__init__.py2
-rw-r--r--synapse/push/emailpusher.py7
-rw-r--r--synapse/push/httppusher.py2
-rw-r--r--synapse/push/pusherpool.py10
85 files changed, 162 insertions, 123 deletions
diff --git a/CHANGES.md b/CHANGES.md

index d6fa92d81c..c596bbf306 100644 --- a/CHANGES.md +++ b/CHANGES.md
@@ -1,3 +1,94 @@ +Synapse 1.25.0rc1 (2021-01-06) +============================== + +Features +-------- + +- Add admin API that lets server admins get power in rooms in which local users have power. ([\#8756](https://github.com/matrix-org/synapse/issues/8756)) +- Add optional HTTP authentication to replication endpoints. ([\#8853](https://github.com/matrix-org/synapse/issues/8853)) +- Improve the error messages printed as a result of configuration problems for extension modules. ([\#8874](https://github.com/matrix-org/synapse/issues/8874)) +- Add number of local devices to Room Details Admin API. Contributed by @dklimpel. ([\#8886](https://github.com/matrix-org/synapse/issues/8886)) +- Add `X-Robots-Tag` header to stop web crawlers from indexing media. ([\#8887](https://github.com/matrix-org/synapse/issues/8887)) +- Spam-checkers may now define their methods as `async`. ([\#8890](https://github.com/matrix-org/synapse/issues/8890)) +- Add support for allowing users to pick their own user ID during a single-sign-on login. ([\#8897](https://github.com/matrix-org/synapse/issues/8897), [\#8900](https://github.com/matrix-org/synapse/issues/8900), [\#8911](https://github.com/matrix-org/synapse/issues/8911), [\#8938](https://github.com/matrix-org/synapse/issues/8938), [\#8941](https://github.com/matrix-org/synapse/issues/8941), [\#8942](https://github.com/matrix-org/synapse/issues/8942), [\#8951](https://github.com/matrix-org/synapse/issues/8951)) +- Add an `email.invite_client_location` configuration option to send a web client location to the invite endpoint on the identity server which allows customisation of the email template. ([\#8930](https://github.com/matrix-org/synapse/issues/8930)) +- Make search statement in List Room and List User Admin API case-insensitive. ([\#8931](https://github.com/matrix-org/synapse/issues/8931)) +- Apply an IP range blacklist to push and key revocation requests. ([\#8954](https://github.com/matrix-org/synapse/issues/8954)) +- Allow re-using an user-interactive authentication session for a period of time. ([\#8970](https://github.com/matrix-org/synapse/issues/8970)) +- Allow running the redact endpoint on workers. ([\#8994](https://github.com/matrix-org/synapse/issues/8994)) + + +Bugfixes +-------- + +- Apply an IP range blacklist to push and key revocation requests. ([\#8821](https://github.com/matrix-org/synapse/issues/8821), [\#8870](https://github.com/matrix-org/synapse/issues/8870)) +- Fix bug where we might not correctly calculate the current state for rooms with multiple extremities. ([\#8827](https://github.com/matrix-org/synapse/issues/8827)) +- Fix a long standing bug in the register admin endpoint (`/_synapse/admin/v1/register`) when the `mac` field was not provided. The endpoint now properly returns a 400 error. Contributed by @edwargix. ([\#8837](https://github.com/matrix-org/synapse/issues/8837)) +- Fix a long-standing bug on Synapse instances supporting Single-Sign-On, where users would be prompted to enter their password to confirm certain actions, even though they have not set a password. ([\#8858](https://github.com/matrix-org/synapse/issues/8858)) +- Fix a longstanding bug where a 500 error would be returned if the `Content-Length` header was not provided to the upload media resource. ([\#8862](https://github.com/matrix-org/synapse/issues/8862)) +- Add additional validation to pusher URLs to be compliant with the specification. ([\#8865](https://github.com/matrix-org/synapse/issues/8865)) +- Fix the error code that is returned when a user tries to register on a homeserver on which new-user registration has been disabled. ([\#8867](https://github.com/matrix-org/synapse/issues/8867)) +- Fix a bug where `PUT /_synapse/admin/v2/users/<user_id>` failed to create a new user when `avatar_url` is specified. Bug introduced in Synapse v1.9.0. ([\#8872](https://github.com/matrix-org/synapse/issues/8872)) +- Fix a 500 error when attempting to preview an empty HTML file. ([\#8883](https://github.com/matrix-org/synapse/issues/8883)) +- Fix occasional deadlock when handling SIGHUP. ([\#8918](https://github.com/matrix-org/synapse/issues/8918)) +- Fix login API to not ratelimit application services that have ratelimiting disabled. ([\#8920](https://github.com/matrix-org/synapse/issues/8920)) +- Fix bug where we ratelimited auto joining of rooms on registration (using `auto_join_rooms` config). ([\#8921](https://github.com/matrix-org/synapse/issues/8921)) +- Fix a bug where deactivated users appeared in the user directory when their profile information was updated. ([\#8933](https://github.com/matrix-org/synapse/issues/8933), [\#8964](https://github.com/matrix-org/synapse/issues/8964)) +- Fix bug introduced in Synapse v1.24.0 which would cause an exception on startup if both `enabled` and `localdb_enabled` were set to `False` in the `password_config` setting of the configuration file. ([\#8937](https://github.com/matrix-org/synapse/issues/8937)) +- Fix a bug where 500 errors would be returned if the `m.room_history_visibility` event had invalid content. ([\#8945](https://github.com/matrix-org/synapse/issues/8945)) +- Fix a bug causing common English words to not be considered for a user directory search. ([\#8959](https://github.com/matrix-org/synapse/issues/8959)) +- Fix bug where application services couldn't register new ghost users if the server had reached its MAU limit. ([\#8962](https://github.com/matrix-org/synapse/issues/8962)) +- Fix a longstanding bug where a `m.image` event without a `url` would cause errors on push. ([\#8965](https://github.com/matrix-org/synapse/issues/8965)) +- Fix small bug in v2 state resolution algorithm, which could also cause performance issues for rooms with large numbers of power levels. ([\#8971](https://github.com/matrix-org/synapse/issues/8971)) +- Add validation to the `sendToDevice` API to raise a missing parameters error instead of a 500 error. ([\#8975](https://github.com/matrix-org/synapse/issues/8975)) +- Properly return 400 errors on invalid group IDs. ([\#8977](https://github.com/matrix-org/synapse/issues/8977)) + + +Improved Documentation +---------------------- + +- Fix the "Event persist rate" section of the included grafana dashboard by adding missing prometheus rules. ([\#8802](https://github.com/matrix-org/synapse/issues/8802)) +- Combine related media admin API docs. ([\#8839](https://github.com/matrix-org/synapse/issues/8839)) +- Fix an error in the documentation for the SAML username mapping provider. ([\#8873](https://github.com/matrix-org/synapse/issues/8873)) +- Clarify comments around template directories in `sample_config.yaml`. ([\#8891](https://github.com/matrix-org/synapse/issues/8891)) +- Moved instructions for database setup, adjusted heading levels and improved syntax highlighting in [INSTALL.md](../INSTALL.md). Contributed by fossterer. ([\#8987](https://github.com/matrix-org/synapse/issues/8987)) +- Update the example value of `group_creation_prefix` in the sample configuration. ([\#8992](https://github.com/matrix-org/synapse/issues/8992)) +- Link the Synapse developer room to the development section in the docs. ([\#9002](https://github.com/matrix-org/synapse/issues/9002)) + + +Deprecations and Removals +------------------------- + +- Deprecate Shutdown Room and Purge Room Admin APIs. ([\#8829](https://github.com/matrix-org/synapse/issues/8829)) + + +Internal Changes +---------------- + +- Properly store the mapping of external ID to Matrix ID for CAS users. ([\#8856](https://github.com/matrix-org/synapse/issues/8856), [\#8958](https://github.com/matrix-org/synapse/issues/8958)) +- Remove some unnecessary stubbing from unit tests. ([\#8861](https://github.com/matrix-org/synapse/issues/8861)) +- Remove unused `FakeResponse` class from unit tests. ([\#8864](https://github.com/matrix-org/synapse/issues/8864)) +- Pass `room_id` to `get_auth_chain_difference`. ([\#8879](https://github.com/matrix-org/synapse/issues/8879)) +- Add type hints to push module. ([\#8880](https://github.com/matrix-org/synapse/issues/8880), [\#8882](https://github.com/matrix-org/synapse/issues/8882), [\#8901](https://github.com/matrix-org/synapse/issues/8901), [\#8940](https://github.com/matrix-org/synapse/issues/8940), [\#8943](https://github.com/matrix-org/synapse/issues/8943), [\#9020](https://github.com/matrix-org/synapse/issues/9020)) +- Simplify logic for handling user-interactive-auth via single-sign-on servers. ([\#8881](https://github.com/matrix-org/synapse/issues/8881)) +- Skip the SAML tests if the requirements (`pysaml2` and `xmlsec1`) aren't available. ([\#8905](https://github.com/matrix-org/synapse/issues/8905)) +- Fix multiarch docker image builds. ([\#8906](https://github.com/matrix-org/synapse/issues/8906)) +- Don't publish `latest` docker image until all archs are built. ([\#8909](https://github.com/matrix-org/synapse/issues/8909)) +- Various clean-ups to the structured logging and logging context code. ([\#8916](https://github.com/matrix-org/synapse/issues/8916), [\#8935](https://github.com/matrix-org/synapse/issues/8935)) +- Automatically drop stale forward-extremities under some specific conditions. ([\#8929](https://github.com/matrix-org/synapse/issues/8929)) +- Refactor test utilities for injecting HTTP requests. ([\#8946](https://github.com/matrix-org/synapse/issues/8946)) +- Add a maximum size of 50 kilobytes to .well-known lookups. ([\#8950](https://github.com/matrix-org/synapse/issues/8950)) +- Fix bug in `generate_log_config` script which made it write empty files. ([\#8952](https://github.com/matrix-org/synapse/issues/8952)) +- Clean up tox.ini file; disable coverage checking for non-test runs. ([\#8963](https://github.com/matrix-org/synapse/issues/8963)) +- Add type hints to the admin and room list handlers. ([\#8973](https://github.com/matrix-org/synapse/issues/8973)) +- Add type hints to the receipts and user directory handlers. ([\#8976](https://github.com/matrix-org/synapse/issues/8976)) +- Drop the unused `local_invites` table. ([\#8979](https://github.com/matrix-org/synapse/issues/8979)) +- Add type hints to the base storage code. ([\#8980](https://github.com/matrix-org/synapse/issues/8980)) +- Support using PyJWT v2.0.0 in the test suite. ([\#8986](https://github.com/matrix-org/synapse/issues/8986)) +- Fix `tests.federation.transport.RoomDirectoryFederationTests` and ensure it runs in CI. ([\#8998](https://github.com/matrix-org/synapse/issues/8998)) +- Add type hints to the crypto module. ([\#8999](https://github.com/matrix-org/synapse/issues/8999)) + + Synapse 1.25.0 (2020-xx-xx) =========================== diff --git a/changelog.d/8756.feature b/changelog.d/8756.feature deleted file mode 100644
index 03eb79fb0a..0000000000 --- a/changelog.d/8756.feature +++ /dev/null
@@ -1 +0,0 @@ -Add admin API that lets server admins get power in rooms in which local users have power. diff --git a/changelog.d/8802.doc b/changelog.d/8802.doc deleted file mode 100644
index 580c4281f8..0000000000 --- a/changelog.d/8802.doc +++ /dev/null
@@ -1 +0,0 @@ -Fix the "Event persist rate" section of the included grafana dashboard by adding missing prometheus rules. diff --git a/changelog.d/8821.bugfix b/changelog.d/8821.bugfix deleted file mode 100644
index 39f53174ad..0000000000 --- a/changelog.d/8821.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Apply an IP range blacklist to push and key revocation requests. diff --git a/changelog.d/8827.bugfix b/changelog.d/8827.bugfix deleted file mode 100644
index 18195680d3..0000000000 --- a/changelog.d/8827.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix bug where we might not correctly calculate the current state for rooms with multiple extremities. diff --git a/changelog.d/8829.removal b/changelog.d/8829.removal deleted file mode 100644
index 2f3708218b..0000000000 --- a/changelog.d/8829.removal +++ /dev/null
@@ -1 +0,0 @@ -Deprecate Shutdown Room and Purge Room Admin APIs. diff --git a/changelog.d/8837.bugfix b/changelog.d/8837.bugfix deleted file mode 100644
index b2977d0c31..0000000000 --- a/changelog.d/8837.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a long standing bug in the register admin endpoint (`/_synapse/admin/v1/register`) when the `mac` field was not provided. The endpoint now properly returns a 400 error. Contributed by @edwargix. diff --git a/changelog.d/8839.doc b/changelog.d/8839.doc deleted file mode 100644
index c35c59a763..0000000000 --- a/changelog.d/8839.doc +++ /dev/null
@@ -1 +0,0 @@ -Combine related media admin API docs. \ No newline at end of file diff --git a/changelog.d/8853.feature b/changelog.d/8853.feature deleted file mode 100644
index 63c59f4ff2..0000000000 --- a/changelog.d/8853.feature +++ /dev/null
@@ -1 +0,0 @@ -Add optional HTTP authentication to replication endpoints. diff --git a/changelog.d/8856.misc b/changelog.d/8856.misc deleted file mode 100644
index 1507073e4f..0000000000 --- a/changelog.d/8856.misc +++ /dev/null
@@ -1 +0,0 @@ -Properly store the mapping of external ID to Matrix ID for CAS users. diff --git a/changelog.d/8858.bugfix b/changelog.d/8858.bugfix deleted file mode 100644
index 0d58cb9abc..0000000000 --- a/changelog.d/8858.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a long-standing bug on Synapse instances supporting Single-Sign-On, where users would be prompted to enter their password to confirm certain actions, even though they have not set a password. diff --git a/changelog.d/8861.misc b/changelog.d/8861.misc deleted file mode 100644
index 9821f804cf..0000000000 --- a/changelog.d/8861.misc +++ /dev/null
@@ -1 +0,0 @@ -Remove some unnecessary stubbing from unit tests. diff --git a/changelog.d/8862.bugfix b/changelog.d/8862.bugfix deleted file mode 100644
index bdbd633f72..0000000000 --- a/changelog.d/8862.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a longstanding bug where a 500 error would be returned if the `Content-Length` header was not provided to the upload media resource. diff --git a/changelog.d/8864.misc b/changelog.d/8864.misc deleted file mode 100644
index a780883495..0000000000 --- a/changelog.d/8864.misc +++ /dev/null
@@ -1 +0,0 @@ -Remove unused `FakeResponse` class from unit tests. diff --git a/changelog.d/8865.bugfix b/changelog.d/8865.bugfix deleted file mode 100644
index a1e625f552..0000000000 --- a/changelog.d/8865.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Add additional validation to pusher URLs to be compliant with the specification. diff --git a/changelog.d/8867.bugfix b/changelog.d/8867.bugfix deleted file mode 100644
index f2414ff111..0000000000 --- a/changelog.d/8867.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix the error code that is returned when a user tries to register on a homeserver on which new-user registration has been disabled. diff --git a/changelog.d/8870.bugfix b/changelog.d/8870.bugfix deleted file mode 100644
index 39f53174ad..0000000000 --- a/changelog.d/8870.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Apply an IP range blacklist to push and key revocation requests. diff --git a/changelog.d/8872.bugfix b/changelog.d/8872.bugfix deleted file mode 100644
index ed00b70a0f..0000000000 --- a/changelog.d/8872.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a bug where `PUT /_synapse/admin/v2/users/<user_id>` failed to create a new user when `avatar_url` is specified. Bug introduced in Synapse v1.9.0. diff --git a/changelog.d/8873.doc b/changelog.d/8873.doc deleted file mode 100644
index 0c2a043bd1..0000000000 --- a/changelog.d/8873.doc +++ /dev/null
@@ -1 +0,0 @@ -Fix an error in the documentation for the SAML username mapping provider. diff --git a/changelog.d/8874.feature b/changelog.d/8874.feature deleted file mode 100644
index 720665ecac..0000000000 --- a/changelog.d/8874.feature +++ /dev/null
@@ -1 +0,0 @@ -Improve the error messages printed as a result of configuration problems for extension modules. diff --git a/changelog.d/8879.misc b/changelog.d/8879.misc deleted file mode 100644
index 6f9516b314..0000000000 --- a/changelog.d/8879.misc +++ /dev/null
@@ -1 +0,0 @@ -Pass `room_id` to `get_auth_chain_difference`. diff --git a/changelog.d/8880.misc b/changelog.d/8880.misc deleted file mode 100644
index 4ff0b94b94..0000000000 --- a/changelog.d/8880.misc +++ /dev/null
@@ -1 +0,0 @@ -Add type hints to push module. diff --git a/changelog.d/8881.misc b/changelog.d/8881.misc deleted file mode 100644
index 07d3f30fb2..0000000000 --- a/changelog.d/8881.misc +++ /dev/null
@@ -1 +0,0 @@ -Simplify logic for handling user-interactive-auth via single-sign-on servers. diff --git a/changelog.d/8882.misc b/changelog.d/8882.misc deleted file mode 100644
index 4ff0b94b94..0000000000 --- a/changelog.d/8882.misc +++ /dev/null
@@ -1 +0,0 @@ -Add type hints to push module. diff --git a/changelog.d/8883.bugfix b/changelog.d/8883.bugfix deleted file mode 100644
index 6137fc5b2b..0000000000 --- a/changelog.d/8883.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a 500 error when attempting to preview an empty HTML file. diff --git a/changelog.d/8886.feature b/changelog.d/8886.feature deleted file mode 100644
index 9e446f28bd..0000000000 --- a/changelog.d/8886.feature +++ /dev/null
@@ -1 +0,0 @@ -Add number of local devices to Room Details Admin API. Contributed by @dklimpel. \ No newline at end of file diff --git a/changelog.d/8887.feature b/changelog.d/8887.feature deleted file mode 100644
index 729eb1f1ea..0000000000 --- a/changelog.d/8887.feature +++ /dev/null
@@ -1 +0,0 @@ -Add `X-Robots-Tag` header to stop web crawlers from indexing media. diff --git a/changelog.d/8890.feature b/changelog.d/8890.feature deleted file mode 100644
index 97aa72a76e..0000000000 --- a/changelog.d/8890.feature +++ /dev/null
@@ -1 +0,0 @@ -Spam-checkers may now define their methods as `async`. diff --git a/changelog.d/8891.doc b/changelog.d/8891.doc deleted file mode 100644
index c3947fe7c2..0000000000 --- a/changelog.d/8891.doc +++ /dev/null
@@ -1 +0,0 @@ -Clarify comments around template directories in `sample_config.yaml`. diff --git a/changelog.d/8897.feature b/changelog.d/8897.feature deleted file mode 100644
index d450ef4998..0000000000 --- a/changelog.d/8897.feature +++ /dev/null
@@ -1 +0,0 @@ -Add support for allowing users to pick their own user ID during a single-sign-on login. diff --git a/changelog.d/8900.feature b/changelog.d/8900.feature deleted file mode 100644
index d450ef4998..0000000000 --- a/changelog.d/8900.feature +++ /dev/null
@@ -1 +0,0 @@ -Add support for allowing users to pick their own user ID during a single-sign-on login. diff --git a/changelog.d/8901.misc b/changelog.d/8901.misc deleted file mode 100644
index 4ff0b94b94..0000000000 --- a/changelog.d/8901.misc +++ /dev/null
@@ -1 +0,0 @@ -Add type hints to push module. diff --git a/changelog.d/8905.misc b/changelog.d/8905.misc deleted file mode 100644
index a9a11a2303..0000000000 --- a/changelog.d/8905.misc +++ /dev/null
@@ -1 +0,0 @@ -Skip the SAML tests if the requirements (`pysaml2` and `xmlsec1`) aren't available. diff --git a/changelog.d/8906.misc b/changelog.d/8906.misc deleted file mode 100644
index 8b95e4c553..0000000000 --- a/changelog.d/8906.misc +++ /dev/null
@@ -1 +0,0 @@ -Fix multiarch docker image builds. diff --git a/changelog.d/8909.misc b/changelog.d/8909.misc deleted file mode 100644
index b45972f0fa..0000000000 --- a/changelog.d/8909.misc +++ /dev/null
@@ -1 +0,0 @@ -Don't publish `latest` docker image until all archs are built. diff --git a/changelog.d/8911.feature b/changelog.d/8911.feature deleted file mode 100644
index d450ef4998..0000000000 --- a/changelog.d/8911.feature +++ /dev/null
@@ -1 +0,0 @@ -Add support for allowing users to pick their own user ID during a single-sign-on login. diff --git a/changelog.d/8916.misc b/changelog.d/8916.misc deleted file mode 100644
index bf94135fd5..0000000000 --- a/changelog.d/8916.misc +++ /dev/null
@@ -1 +0,0 @@ -Various clean-ups to the structured logging and logging context code. diff --git a/changelog.d/8918.bugfix b/changelog.d/8918.bugfix deleted file mode 100644
index ae0f6745d7..0000000000 --- a/changelog.d/8918.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix occasional deadlock when handling SIGHUP. diff --git a/changelog.d/8920.bugfix b/changelog.d/8920.bugfix deleted file mode 100644
index abcf186bda..0000000000 --- a/changelog.d/8920.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix login API to not ratelimit application services that have ratelimiting disabled. diff --git a/changelog.d/8921.bugfix b/changelog.d/8921.bugfix deleted file mode 100644
index 7f6f0b8a76..0000000000 --- a/changelog.d/8921.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix bug where we ratelimited auto joining of rooms on registration (using `auto_join_rooms` config). diff --git a/changelog.d/8929.misc b/changelog.d/8929.misc deleted file mode 100644
index 157018b6a6..0000000000 --- a/changelog.d/8929.misc +++ /dev/null
@@ -1 +0,0 @@ -Automatically drop stale forward-extremities under some specific conditions. diff --git a/changelog.d/8930.feature b/changelog.d/8930.feature deleted file mode 100644
index cb305b5266..0000000000 --- a/changelog.d/8930.feature +++ /dev/null
@@ -1 +0,0 @@ -Add an `email.invite_client_location` configuration option to send a web client location to the invite endpoint on the identity server which allows customisation of the email template. diff --git a/changelog.d/8931.feature b/changelog.d/8931.feature deleted file mode 100644
index 35c720eb8c..0000000000 --- a/changelog.d/8931.feature +++ /dev/null
@@ -1 +0,0 @@ -Make search statement in List Room and List User Admin API case-insensitive. \ No newline at end of file diff --git a/changelog.d/8933.bugfix b/changelog.d/8933.bugfix deleted file mode 100644
index 295933d6cd..0000000000 --- a/changelog.d/8933.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a bug where deactivated users appeared in the user directory when their profile information was updated. diff --git a/changelog.d/8935.misc b/changelog.d/8935.misc deleted file mode 100644
index bf94135fd5..0000000000 --- a/changelog.d/8935.misc +++ /dev/null
@@ -1 +0,0 @@ -Various clean-ups to the structured logging and logging context code. diff --git a/changelog.d/8937.bugfix b/changelog.d/8937.bugfix deleted file mode 100644
index 01e1848448..0000000000 --- a/changelog.d/8937.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix bug introduced in Synapse v1.24.0 which would cause an exception on startup if both `enabled` and `localdb_enabled` were set to `False` in the `password_config` setting of the configuration file. diff --git a/changelog.d/8938.feature b/changelog.d/8938.feature deleted file mode 100644
index d450ef4998..0000000000 --- a/changelog.d/8938.feature +++ /dev/null
@@ -1 +0,0 @@ -Add support for allowing users to pick their own user ID during a single-sign-on login. diff --git a/changelog.d/8940.misc b/changelog.d/8940.misc deleted file mode 100644
index 4ff0b94b94..0000000000 --- a/changelog.d/8940.misc +++ /dev/null
@@ -1 +0,0 @@ -Add type hints to push module. diff --git a/changelog.d/8941.feature b/changelog.d/8941.feature deleted file mode 100644
index d450ef4998..0000000000 --- a/changelog.d/8941.feature +++ /dev/null
@@ -1 +0,0 @@ -Add support for allowing users to pick their own user ID during a single-sign-on login. diff --git a/changelog.d/8942.feature b/changelog.d/8942.feature deleted file mode 100644
index d450ef4998..0000000000 --- a/changelog.d/8942.feature +++ /dev/null
@@ -1 +0,0 @@ -Add support for allowing users to pick their own user ID during a single-sign-on login. diff --git a/changelog.d/8943.misc b/changelog.d/8943.misc deleted file mode 100644
index 4ff0b94b94..0000000000 --- a/changelog.d/8943.misc +++ /dev/null
@@ -1 +0,0 @@ -Add type hints to push module. diff --git a/changelog.d/8945.bugfix b/changelog.d/8945.bugfix deleted file mode 100644
index f9e6dbba56..0000000000 --- a/changelog.d/8945.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a bug where 500 errors would be returned if the `m.room_history_visibility` event had invalid content. diff --git a/changelog.d/8946.misc b/changelog.d/8946.misc deleted file mode 100644
index 54502e9b90..0000000000 --- a/changelog.d/8946.misc +++ /dev/null
@@ -1 +0,0 @@ -Refactor test utilities for injecting HTTP requests. diff --git a/changelog.d/8950.misc b/changelog.d/8950.misc deleted file mode 100644
index 42e0335afc..0000000000 --- a/changelog.d/8950.misc +++ /dev/null
@@ -1 +0,0 @@ -Add a maximum size of 50 kilobytes to .well-known lookups. diff --git a/changelog.d/8951.feature b/changelog.d/8951.feature deleted file mode 100644
index d450ef4998..0000000000 --- a/changelog.d/8951.feature +++ /dev/null
@@ -1 +0,0 @@ -Add support for allowing users to pick their own user ID during a single-sign-on login. diff --git a/changelog.d/8952.misc b/changelog.d/8952.misc deleted file mode 100644
index 4c4a874649..0000000000 --- a/changelog.d/8952.misc +++ /dev/null
@@ -1 +0,0 @@ -Fix bug in `generate_log_config` script which made it write empty files. diff --git a/changelog.d/8954.feature b/changelog.d/8954.feature deleted file mode 100644
index 39f53174ad..0000000000 --- a/changelog.d/8954.feature +++ /dev/null
@@ -1 +0,0 @@ -Apply an IP range blacklist to push and key revocation requests. diff --git a/changelog.d/8958.misc b/changelog.d/8958.misc deleted file mode 100644
index 1507073e4f..0000000000 --- a/changelog.d/8958.misc +++ /dev/null
@@ -1 +0,0 @@ -Properly store the mapping of external ID to Matrix ID for CAS users. diff --git a/changelog.d/8959.bugfix b/changelog.d/8959.bugfix deleted file mode 100644
index 772818bae9..0000000000 --- a/changelog.d/8959.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a bug causing common English words to not be considered for a user directory search. diff --git a/changelog.d/8962.bugfix b/changelog.d/8962.bugfix deleted file mode 100644
index af1a5e4c3a..0000000000 --- a/changelog.d/8962.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix bug where application services couldn't register new ghost users if the server had reached its MAU limit. diff --git a/changelog.d/8963.misc b/changelog.d/8963.misc deleted file mode 100644
index 495d89e8ee..0000000000 --- a/changelog.d/8963.misc +++ /dev/null
@@ -1 +0,0 @@ -Clean up tox.ini file; disable coverage checking for non-test runs. diff --git a/changelog.d/8964.bugfix b/changelog.d/8964.bugfix deleted file mode 100644
index 295933d6cd..0000000000 --- a/changelog.d/8964.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a bug where deactivated users appeared in the user directory when their profile information was updated. diff --git a/changelog.d/8965.bugfix b/changelog.d/8965.bugfix deleted file mode 100644
index cbccebddb5..0000000000 --- a/changelog.d/8965.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix a longstanding bug where a `m.image` event without a `url` would cause errors on push. diff --git a/changelog.d/8970.feature b/changelog.d/8970.feature deleted file mode 100644
index 6d5b3303a6..0000000000 --- a/changelog.d/8970.feature +++ /dev/null
@@ -1 +0,0 @@ -Allow re-using an user-interactive authentication session for a period of time. diff --git a/changelog.d/8971.bugfix b/changelog.d/8971.bugfix deleted file mode 100644
index c3e44b8c0b..0000000000 --- a/changelog.d/8971.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Fix small bug in v2 state resolution algorithm, which could also cause performance issues for rooms with large numbers of power levels. diff --git a/changelog.d/8973.misc b/changelog.d/8973.misc deleted file mode 100644
index be744f5dc7..0000000000 --- a/changelog.d/8973.misc +++ /dev/null
@@ -1 +0,0 @@ -Add type hints to the admin and room list handlers. diff --git a/changelog.d/8975.bugfix b/changelog.d/8975.bugfix deleted file mode 100644
index 75049b8e18..0000000000 --- a/changelog.d/8975.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Add validation to the `sendToDevice` API to raise a missing parameters error instead of a 500 error. diff --git a/changelog.d/8977.bugfix b/changelog.d/8977.bugfix deleted file mode 100644
index ae0b6bec14..0000000000 --- a/changelog.d/8977.bugfix +++ /dev/null
@@ -1 +0,0 @@ -Properly return 400 errors on invalid group IDs. diff --git a/changelog.d/8979.misc b/changelog.d/8979.misc deleted file mode 100644
index 670821cf90..0000000000 --- a/changelog.d/8979.misc +++ /dev/null
@@ -1 +0,0 @@ -Drop the unused `local_invites` table. diff --git a/changelog.d/8980.misc b/changelog.d/8980.misc deleted file mode 100644
index 83ef3c5def..0000000000 --- a/changelog.d/8980.misc +++ /dev/null
@@ -1 +0,0 @@ -Add type hints to the base storage code. diff --git a/changelog.d/8986.misc b/changelog.d/8986.misc deleted file mode 100644
index 6aefc78784..0000000000 --- a/changelog.d/8986.misc +++ /dev/null
@@ -1 +0,0 @@ -Support using PyJWT v2.0.0 in the test suite. diff --git a/changelog.d/8987.doc b/changelog.d/8987.doc deleted file mode 100644
index c6e4932729..0000000000 --- a/changelog.d/8987.doc +++ /dev/null
@@ -1 +0,0 @@ -Moved instructions for database setup, adjusted heading levels and improved syntax highlighting in [INSTALL.md](../INSTALL.md). Contributed by fossterer. diff --git a/changelog.d/8992.doc b/changelog.d/8992.doc deleted file mode 100644
index 6a47bda26b..0000000000 --- a/changelog.d/8992.doc +++ /dev/null
@@ -1 +0,0 @@ -Update the example value of `group_creation_prefix` in the sample configuration. diff --git a/changelog.d/8994.feature b/changelog.d/8994.feature deleted file mode 100644
index 76aeb185cb..0000000000 --- a/changelog.d/8994.feature +++ /dev/null
@@ -1 +0,0 @@ -Allow running the redact endpoint on workers. diff --git a/changelog.d/8998.misc b/changelog.d/8998.misc deleted file mode 100644
index 81346694bd..0000000000 --- a/changelog.d/8998.misc +++ /dev/null
@@ -1 +0,0 @@ -Fix `tests.federation.transport.RoomDirectoryFederationTests` and ensure it runs in CI. \ No newline at end of file diff --git a/changelog.d/8999.misc b/changelog.d/8999.misc deleted file mode 100644
index 3987204f06..0000000000 --- a/changelog.d/8999.misc +++ /dev/null
@@ -1 +0,0 @@ -Add type hints to the crypto module. diff --git a/changelog.d/9002.doc b/changelog.d/9002.doc deleted file mode 100644
index 26928c9a93..0000000000 --- a/changelog.d/9002.doc +++ /dev/null
@@ -1 +0,0 @@ -Link the Synapse developer room to the development section in the docs. diff --git a/mypy.ini b/mypy.ini
index 6a53abfaa9..5d15b7bf1c 100644 --- a/mypy.ini +++ b/mypy.ini
@@ -45,6 +45,7 @@ files = synapse/handlers/presence.py, synapse/handlers/profile.py, synapse/handlers/read_marker.py, + synapse/handlers/receipts.py, synapse/handlers/register.py, synapse/handlers/room.py, synapse/handlers/room_list.py, @@ -53,6 +54,7 @@ files = synapse/handlers/saml_handler.py, synapse/handlers/sso.py, synapse/handlers/sync.py, + synapse/handlers/user_directory.py, synapse/handlers/ui_auth, synapse/http/client.py, synapse/http/federation/matrix_federation_agent.py, diff --git a/synapse/__init__.py b/synapse/__init__.py
index f2d3ac68eb..99fb675748 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py
@@ -48,7 +48,7 @@ try: except ImportError: pass -__version__ = "1.24.0" +__version__ = "1.25.0rc1" if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)): # We import here so that we don't have to install a bunch of deps when diff --git a/synapse/handlers/receipts.py b/synapse/handlers/receipts.py
index e850e45e46..a9abdf42e0 100644 --- a/synapse/handlers/receipts.py +++ b/synapse/handlers/receipts.py
@@ -13,17 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging -from typing import List, Tuple +from typing import TYPE_CHECKING, List, Optional, Tuple from synapse.appservice import ApplicationService from synapse.handlers._base import BaseHandler from synapse.types import JsonDict, ReadReceipt, get_domain_from_id +if TYPE_CHECKING: + from synapse.app.homeserver import HomeServer + logger = logging.getLogger(__name__) class ReceiptsHandler(BaseHandler): - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): super().__init__(hs) self.server_name = hs.config.server_name @@ -36,7 +39,7 @@ class ReceiptsHandler(BaseHandler): self.clock = self.hs.get_clock() self.state = hs.get_state_handler() - async def _received_remote_receipt(self, origin, content): + async def _received_remote_receipt(self, origin: str, content: JsonDict) -> None: """Called when we receive an EDU of type m.receipt from a remote HS. """ receipts = [] @@ -63,11 +66,11 @@ class ReceiptsHandler(BaseHandler): await self._handle_new_receipts(receipts) - async def _handle_new_receipts(self, receipts): + async def _handle_new_receipts(self, receipts: List[ReadReceipt]) -> bool: """Takes a list of receipts, stores them and informs the notifier. """ - min_batch_id = None - max_batch_id = None + min_batch_id = None # type: Optional[int] + max_batch_id = None # type: Optional[int] for receipt in receipts: res = await self.store.insert_receipt( @@ -89,7 +92,8 @@ class ReceiptsHandler(BaseHandler): if max_batch_id is None or max_persisted_id > max_batch_id: max_batch_id = max_persisted_id - if min_batch_id is None: + # Either both of these should be None or neither. + if min_batch_id is None or max_batch_id is None: # no new receipts return False @@ -103,7 +107,9 @@ class ReceiptsHandler(BaseHandler): return True - async def received_client_receipt(self, room_id, receipt_type, user_id, event_id): + async def received_client_receipt( + self, room_id: str, receipt_type: str, user_id: str, event_id: str + ) -> None: """Called when a client tells us a local user has read up to the given event_id in the room. """ @@ -123,10 +129,12 @@ class ReceiptsHandler(BaseHandler): class ReceiptEventSource: - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): self.store = hs.get_datastore() - async def get_new_events(self, from_key, room_ids, **kwargs): + async def get_new_events( + self, from_key: int, room_ids: List[str], **kwargs + ) -> Tuple[List[JsonDict], int]: from_key = int(from_key) to_key = self.get_current_key() @@ -171,5 +179,5 @@ class ReceiptEventSource: return (events, to_key) - def get_current_key(self, direction="f"): + def get_current_key(self, direction: str = "f") -> int: return self.store.get_max_receipt_stream_id() diff --git a/synapse/handlers/user_directory.py b/synapse/handlers/user_directory.py
index 7c4eeaaa5e..d4651c8348 100644 --- a/synapse/handlers/user_directory.py +++ b/synapse/handlers/user_directory.py
@@ -14,14 +14,19 @@ # limitations under the License. import logging +from typing import TYPE_CHECKING, Any, Dict, List, Optional import synapse.metrics from synapse.api.constants import EventTypes, HistoryVisibility, JoinRules, Membership from synapse.handlers.state_deltas import StateDeltasHandler from synapse.metrics.background_process_metrics import run_as_background_process from synapse.storage.roommember import ProfileInfo +from synapse.types import JsonDict from synapse.util.metrics import Measure +if TYPE_CHECKING: + from synapse.app.homeserver import HomeServer + logger = logging.getLogger(__name__) @@ -36,7 +41,7 @@ class UserDirectoryHandler(StateDeltasHandler): be in the directory or not when necessary. """ - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): super().__init__(hs) self.store = hs.get_datastore() @@ -49,7 +54,7 @@ class UserDirectoryHandler(StateDeltasHandler): self.search_all_users = hs.config.user_directory_search_all_users self.spam_checker = hs.get_spam_checker() # The current position in the current_state_delta stream - self.pos = None + self.pos = None # type: Optional[int] # Guard to ensure we only process deltas one at a time self._is_processing = False @@ -61,7 +66,9 @@ class UserDirectoryHandler(StateDeltasHandler): # we start populating the user directory self.clock.call_later(0, self.notify_new_event) - async def search_users(self, user_id, search_term, limit): + async def search_users( + self, user_id: str, search_term: str, limit: int + ) -> JsonDict: """Searches for users in directory Returns: @@ -89,7 +96,7 @@ class UserDirectoryHandler(StateDeltasHandler): return results - def notify_new_event(self): + def notify_new_event(self) -> None: """Called when there may be more deltas to process """ if not self.update_user_directory: @@ -107,7 +114,9 @@ class UserDirectoryHandler(StateDeltasHandler): self._is_processing = True run_as_background_process("user_directory.notify_new_event", process) - async def handle_local_profile_change(self, user_id, profile): + async def handle_local_profile_change( + self, user_id: str, profile: ProfileInfo + ) -> None: """Called to update index of our local user profiles when they change irrespective of any rooms the user may be in. """ @@ -124,14 +133,14 @@ class UserDirectoryHandler(StateDeltasHandler): user_id, profile.display_name, profile.avatar_url ) - async def handle_user_deactivated(self, user_id): + async def handle_user_deactivated(self, user_id: str) -> None: """Called when a user ID is deactivated """ # FIXME(#3714): We should probably do this in the same worker as all # the other changes. await self.store.remove_from_user_dir(user_id) - async def _unsafe_process(self): + async def _unsafe_process(self) -> None: # If self.pos is None then means we haven't fetched it from DB if self.pos is None: self.pos = await self.store.get_user_directory_stream_pos() @@ -166,7 +175,7 @@ class UserDirectoryHandler(StateDeltasHandler): await self.store.update_user_directory_stream_pos(max_pos) - async def _handle_deltas(self, deltas): + async def _handle_deltas(self, deltas: List[Dict[str, Any]]) -> None: """Called with the state deltas to process """ for delta in deltas: @@ -236,16 +245,20 @@ class UserDirectoryHandler(StateDeltasHandler): logger.debug("Ignoring irrelevant type: %r", typ) async def _handle_room_publicity_change( - self, room_id, prev_event_id, event_id, typ - ): + self, + room_id: str, + prev_event_id: Optional[str], + event_id: Optional[str], + typ: str, + ) -> None: """Handle a room having potentially changed from/to world_readable/publicly joinable. Args: - room_id (str) - prev_event_id (str|None): The previous event before the state change - event_id (str|None): The new event after the state change - typ (str): Type of the event + room_id: The ID of the room which changed. + prev_event_id: The previous event before the state change + event_id: The new event after the state change + typ: Type of the event """ logger.debug("Handling change for %s: %s", typ, room_id) @@ -303,12 +316,14 @@ class UserDirectoryHandler(StateDeltasHandler): for user_id, profile in users_with_profile.items(): await self._handle_new_user(room_id, user_id, profile) - async def _handle_new_user(self, room_id, user_id, profile): + async def _handle_new_user( + self, room_id: str, user_id: str, profile: ProfileInfo + ) -> None: """Called when we might need to add user to directory Args: - room_id (str): room_id that user joined or started being public - user_id (str) + room_id: The room ID that user joined or started being public + user_id """ logger.debug("Adding new user to dir, %r", user_id) @@ -356,12 +371,12 @@ class UserDirectoryHandler(StateDeltasHandler): if to_insert: await self.store.add_users_who_share_private_room(room_id, to_insert) - async def _handle_remove_user(self, room_id, user_id): + async def _handle_remove_user(self, room_id: str, user_id: str) -> None: """Called when we might need to remove user from directory Args: - room_id (str): room_id that user left or stopped being public that - user_id (str) + room_id: The room ID that user left or stopped being public that + user_id """ logger.debug("Removing user %r", user_id) @@ -374,7 +389,13 @@ class UserDirectoryHandler(StateDeltasHandler): if len(rooms_user_is_in) == 0: await self.store.remove_from_user_dir(user_id) - async def _handle_profile_change(self, user_id, room_id, prev_event_id, event_id): + async def _handle_profile_change( + self, + user_id: str, + room_id: str, + prev_event_id: Optional[str], + event_id: Optional[str], + ) -> None: """Check member event changes for any profile changes and update the database if there are. """ diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py
index 9e7ac149a1..f4f7ec96f8 100644 --- a/synapse/push/__init__.py +++ b/synapse/push/__init__.py
@@ -40,7 +40,7 @@ class PusherConfig: ts = attr.ib(type=int) lang = attr.ib(type=Optional[str]) data = attr.ib(type=Optional[JsonDict]) - last_stream_ordering = attr.ib(type=Optional[int]) + last_stream_ordering = attr.ib(type=int) last_success = attr.ib(type=Optional[int]) failing_since = attr.ib(type=Optional[int]) diff --git a/synapse/push/emailpusher.py b/synapse/push/emailpusher.py
index d2eff75a58..4ac1b31748 100644 --- a/synapse/push/emailpusher.py +++ b/synapse/push/emailpusher.py
@@ -157,7 +157,6 @@ class EmailPusher(Pusher): being run. """ start = 0 if INCLUDE_ALL_UNREAD_NOTIFS else self.last_stream_ordering - assert start is not None unprocessed = await self.store.get_unread_push_actions_for_user_in_range_for_email( self.user_id, start, self.max_stream_ordering ) @@ -220,12 +219,8 @@ class EmailPusher(Pusher): ) async def save_last_stream_ordering_and_success( - self, last_stream_ordering: Optional[int] + self, last_stream_ordering: int ) -> None: - if last_stream_ordering is None: - # This happens if we haven't yet processed anything - return - self.last_stream_ordering = last_stream_ordering pusher_still_exists = await self.store.update_pusher_last_stream_ordering_and_success( self.app_id, diff --git a/synapse/push/httppusher.py b/synapse/push/httppusher.py
index 417fe0f1f5..e048b0d59e 100644 --- a/synapse/push/httppusher.py +++ b/synapse/push/httppusher.py
@@ -176,7 +176,6 @@ class HttpPusher(Pusher): Never call this directly: use _process which will only allow this to run once per pusher. """ - assert self.last_stream_ordering is not None unprocessed = await self.store.get_unread_push_actions_for_user_in_range_for_http( self.user_id, self.last_stream_ordering, self.max_stream_ordering ) @@ -205,7 +204,6 @@ class HttpPusher(Pusher): http_push_processed_counter.inc() self.backoff_delay = HttpPusher.INITIAL_BACKOFF_SEC self.last_stream_ordering = push_action["stream_ordering"] - assert self.last_stream_ordering is not None pusher_still_exists = await self.store.update_pusher_last_stream_ordering_and_success( self.app_id, self.pushkey, diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py
index 37f3193917..3e843c97fe 100644 --- a/synapse/push/pusherpool.py +++ b/synapse/push/pusherpool.py
@@ -106,6 +106,10 @@ class PusherPool: time_now_msec = self.clock.time_msec() + # create the pusher setting last_stream_ordering to the current maximum + # stream ordering, so it will process pushes from this point onwards. + last_stream_ordering = self.store.get_room_max_stream_ordering() + # we try to create the pusher just to validate the config: it # will then get pulled out of the database, # recreated, added and started: this means we have only one @@ -124,16 +128,12 @@ class PusherPool: ts=time_now_msec, lang=lang, data=data, - last_stream_ordering=None, + last_stream_ordering=last_stream_ordering, last_success=None, failing_since=None, ) ) - # create the pusher setting last_stream_ordering to the current maximum - # stream ordering, so it will process pushes from this point onwards. - last_stream_ordering = self.store.get_room_max_stream_ordering() - await self.store.add_pusher( user_id=user_id, access_token=access_token,