Merge branch 'develop' into anoa/msc_1711

This commit is contained in:
Andrew Morgan 2019-04-01 18:01:02 +01:00
commit 86dfaf4d76
135 changed files with 546 additions and 320 deletions

View file

@ -1,3 +1,102 @@
Synapse 0.99.3 (2019-04-01)
===========================
No significant changes.
Synapse 0.99.3rc1 (2019-03-27)
==============================
Features
--------
- The user directory has been rewritten to make it faster, with less chance of falling behind on a large server. ([\#4537](https://github.com/matrix-org/synapse/issues/4537), [\#4846](https://github.com/matrix-org/synapse/issues/4846), [\#4864](https://github.com/matrix-org/synapse/issues/4864), [\#4887](https://github.com/matrix-org/synapse/issues/4887), [\#4900](https://github.com/matrix-org/synapse/issues/4900), [\#4944](https://github.com/matrix-org/synapse/issues/4944))
- Add configurable rate limiting to the /register endpoint. ([\#4735](https://github.com/matrix-org/synapse/issues/4735), [\#4804](https://github.com/matrix-org/synapse/issues/4804))
- Move server key queries to federation reader. ([\#4757](https://github.com/matrix-org/synapse/issues/4757))
- Add support for /account/3pid REST endpoint to client_reader worker. ([\#4759](https://github.com/matrix-org/synapse/issues/4759))
- Add an endpoint to the admin API for querying the server version. Contributed by Joseph Weston. ([\#4772](https://github.com/matrix-org/synapse/issues/4772))
- Include a default configuration file in the 'docs' directory. ([\#4791](https://github.com/matrix-org/synapse/issues/4791), [\#4801](https://github.com/matrix-org/synapse/issues/4801))
- Synapse is now permissive about trailing slashes on some of its federation endpoints, allowing zero or more to be present. ([\#4793](https://github.com/matrix-org/synapse/issues/4793))
- Add support for /keys/query and /keys/changes REST endpoints to client_reader worker. ([\#4796](https://github.com/matrix-org/synapse/issues/4796))
- Add checks to incoming events over federation for events evading auth (aka "soft fail"). ([\#4814](https://github.com/matrix-org/synapse/issues/4814))
- Add configurable rate limiting to the /login endpoint. ([\#4821](https://github.com/matrix-org/synapse/issues/4821), [\#4865](https://github.com/matrix-org/synapse/issues/4865))
- Remove trailing slashes from certain outbound federation requests. Retry if receiving a 404. Context: #3622. ([\#4840](https://github.com/matrix-org/synapse/issues/4840))
- Allow passing --daemonize flags to workers in the same way as with master. ([\#4853](https://github.com/matrix-org/synapse/issues/4853))
- Batch up outgoing read-receipts to reduce federation traffic. ([\#4890](https://github.com/matrix-org/synapse/issues/4890), [\#4927](https://github.com/matrix-org/synapse/issues/4927))
- Add option to disable searching the user directory. ([\#4895](https://github.com/matrix-org/synapse/issues/4895))
- Add option to disable searching of local and remote public room lists. ([\#4896](https://github.com/matrix-org/synapse/issues/4896))
- Add ability for password providers to login/register a user via 3PID (email, phone). ([\#4931](https://github.com/matrix-org/synapse/issues/4931))
Bugfixes
--------
- Fix a bug where media with spaces in the name would get a corrupted name. ([\#2090](https://github.com/matrix-org/synapse/issues/2090))
- Fix attempting to paginate in rooms where server cannot see any events, to avoid unnecessarily pulling in lots of redacted events. ([\#4699](https://github.com/matrix-org/synapse/issues/4699))
- 'event_id' is now a required parameter in federated state requests, as per the matrix spec. ([\#4740](https://github.com/matrix-org/synapse/issues/4740))
- Fix tightloop over connecting to replication server. ([\#4749](https://github.com/matrix-org/synapse/issues/4749))
- Fix parsing of Content-Disposition headers on remote media requests and URL previews. ([\#4763](https://github.com/matrix-org/synapse/issues/4763))
- Fix incorrect log about not persisting duplicate state event. ([\#4776](https://github.com/matrix-org/synapse/issues/4776))
- Fix v4v6 option in HAProxy example config. Contributed by Flakebi. ([\#4790](https://github.com/matrix-org/synapse/issues/4790))
- Handle batch updates in worker replication protocol. ([\#4792](https://github.com/matrix-org/synapse/issues/4792))
- Fix bug where we didn't correctly throttle sending of USER_IP commands over replication. ([\#4818](https://github.com/matrix-org/synapse/issues/4818))
- Fix potential race in handling missing updates in device list updates. ([\#4829](https://github.com/matrix-org/synapse/issues/4829))
- Fix bug where synapse expected an un-specced `prev_state` field on state events. ([\#4837](https://github.com/matrix-org/synapse/issues/4837))
- Transfer a user's notification settings (push rules) on room upgrade. ([\#4838](https://github.com/matrix-org/synapse/issues/4838))
- fix test_auto_create_auto_join_where_no_consent. ([\#4886](https://github.com/matrix-org/synapse/issues/4886))
- Fix a bug where hs_disabled_message was sometimes not correctly enforced. ([\#4888](https://github.com/matrix-org/synapse/issues/4888))
- Fix bug in shutdown room admin API where it would fail if a user in the room hadn't consented to the privacy policy. ([\#4904](https://github.com/matrix-org/synapse/issues/4904))
- Fix bug where blocked world-readable rooms were still peekable. ([\#4908](https://github.com/matrix-org/synapse/issues/4908))
Internal Changes
----------------
- Add a systemd setup that supports synapse workers. Contributed by Luca Corbatto. ([\#4662](https://github.com/matrix-org/synapse/issues/4662))
- Change from TravisCI to Buildkite for CI. ([\#4752](https://github.com/matrix-org/synapse/issues/4752))
- When presence is disabled don't send over replication. ([\#4757](https://github.com/matrix-org/synapse/issues/4757))
- Minor docstring fixes for MatrixFederationAgent. ([\#4765](https://github.com/matrix-org/synapse/issues/4765))
- Optimise EDU transmission for the federation_sender worker. ([\#4770](https://github.com/matrix-org/synapse/issues/4770))
- Update test_typing to use HomeserverTestCase. ([\#4771](https://github.com/matrix-org/synapse/issues/4771))
- Update URLs for riot.im icons and logos in the default notification templates. ([\#4779](https://github.com/matrix-org/synapse/issues/4779))
- Removed unnecessary $ from some federation endpoint path regexes. ([\#4794](https://github.com/matrix-org/synapse/issues/4794))
- Remove link to deleted title in README. ([\#4795](https://github.com/matrix-org/synapse/issues/4795))
- Clean up read-receipt handling. ([\#4797](https://github.com/matrix-org/synapse/issues/4797))
- Add some debug about processing read receipts. ([\#4798](https://github.com/matrix-org/synapse/issues/4798))
- Clean up some replication code. ([\#4799](https://github.com/matrix-org/synapse/issues/4799))
- Add some docstrings. ([\#4815](https://github.com/matrix-org/synapse/issues/4815))
- Add debug logger to try and track down #4422. ([\#4816](https://github.com/matrix-org/synapse/issues/4816))
- Make shutdown API send explanation message to room after users have been forced joined. ([\#4817](https://github.com/matrix-org/synapse/issues/4817))
- Update example_log_config.yaml. ([\#4820](https://github.com/matrix-org/synapse/issues/4820))
- Document the `generate` option for the docker image. ([\#4824](https://github.com/matrix-org/synapse/issues/4824))
- Fix check-newsfragment for debian-only changes. ([\#4825](https://github.com/matrix-org/synapse/issues/4825))
- Add some debug logging for device list updates to help with #4828. ([\#4828](https://github.com/matrix-org/synapse/issues/4828))
- Improve federation documentation, specifically .well-known support. Many thanks to @vaab. ([\#4832](https://github.com/matrix-org/synapse/issues/4832))
- Disable captcha registration by default in unit tests. ([\#4839](https://github.com/matrix-org/synapse/issues/4839))
- Add stuff back to the .gitignore. ([\#4843](https://github.com/matrix-org/synapse/issues/4843))
- Clarify what registration_shared_secret allows for. ([\#4844](https://github.com/matrix-org/synapse/issues/4844))
- Correctly log expected errors when fetching server keys. ([\#4847](https://github.com/matrix-org/synapse/issues/4847))
- Update install docs to explicitly state a full-chain (not just the top-level) TLS certificate must be provided to Synapse. This caused some people's Synapse ports to appear correct in a browser but still (rightfully so) upset the federation tester. ([\#4849](https://github.com/matrix-org/synapse/issues/4849))
- Move client read-receipt processing to federation sender worker. ([\#4852](https://github.com/matrix-org/synapse/issues/4852))
- Refactor federation TransactionQueue. ([\#4855](https://github.com/matrix-org/synapse/issues/4855))
- Comment out most options in the generated config. ([\#4863](https://github.com/matrix-org/synapse/issues/4863))
- Fix yaml library warnings by using safe_load. ([\#4869](https://github.com/matrix-org/synapse/issues/4869))
- Update Apache setup to remove location syntax. Thanks to @cwmke! ([\#4870](https://github.com/matrix-org/synapse/issues/4870))
- Reinstate test case that runs unit tests against oldest supported dependencies. ([\#4879](https://github.com/matrix-org/synapse/issues/4879))
- Update link to federation docs. ([\#4881](https://github.com/matrix-org/synapse/issues/4881))
- fix test_auto_create_auto_join_where_no_consent. ([\#4886](https://github.com/matrix-org/synapse/issues/4886))
- Use a regular HomeServerConfig object for unit tests rater than a Mock. ([\#4889](https://github.com/matrix-org/synapse/issues/4889))
- Add some notes about tuning postgres for larger deployments. ([\#4895](https://github.com/matrix-org/synapse/issues/4895))
- Add a config option for torture-testing worker replication. ([\#4902](https://github.com/matrix-org/synapse/issues/4902))
- Log requests which are simulated by the unit tests. ([\#4905](https://github.com/matrix-org/synapse/issues/4905))
- Allow newsfragments to end with exclamation marks. Exciting! ([\#4912](https://github.com/matrix-org/synapse/issues/4912))
- Refactor some more tests to use HomeserverTestCase. ([\#4913](https://github.com/matrix-org/synapse/issues/4913))
- Refactor out the state deltas portion of the user directory store and handler. ([\#4917](https://github.com/matrix-org/synapse/issues/4917))
- Fix nginx example in ACME doc. ([\#4923](https://github.com/matrix-org/synapse/issues/4923))
- Use an explicit dbname for postgres connections in the tests. ([\#4928](https://github.com/matrix-org/synapse/issues/4928))
- Fix `ClientReplicationStreamProtocol.__str__()`. ([\#4929](https://github.com/matrix-org/synapse/issues/4929))
Synapse 0.99.2 (2019-03-01)
===========================

View file

@ -384,7 +384,7 @@ To configure Synapse to expose an HTTPS port, you will need to edit
`cert.pem`).
For those of you upgrading your TLS certificate in readiness for Synapse 1.0,
please take a look at `our guide <docs/MSC1711_certificates_FAQ.md#configuring-certificates-for-compatibility-with-synapse-100>`_.
please take a look at [our guide](docs/MSC1711_certificates_FAQ.md#configuring-certificates-for-compatibility-with-synapse-100).
## Registering a user

View file

@ -1 +0,0 @@
Fix a bug where media with spaces in the name would get a corrupted name.

1
changelog.d/4474.misc Normal file
View file

@ -0,0 +1 @@
Add test to verify threepid auth check added in #4435.

View file

@ -1 +0,0 @@
The user directory has been rewritten to make it faster, with less chance of falling behind on a large server.

View file

@ -1 +0,0 @@
Add a systemd setup that supports synapse workers. Contributed by Luca Corbatto.

View file

@ -1 +0,0 @@
Fix attempting to paginate in rooms where server cannot see any events, to avoid unnecessarily pulling in lots of redacted events.

View file

@ -1 +0,0 @@
Add configurable rate limiting to the /register endpoint.

View file

@ -1 +0,0 @@
'event_id' is now a required parameter in federated state requests, as per the matrix spec.

View file

@ -1 +0,0 @@
Fix tightloop over connecting to replication server.

View file

@ -1 +0,0 @@
Change from TravisCI to Buildkite for CI.

View file

@ -1 +0,0 @@
Move server key queries to federation reader.

View file

@ -1 +0,0 @@
When presence is disabled don't send over replication.

View file

@ -1 +0,0 @@
Add support for /account/3pid REST endpoint to client_reader worker.

View file

@ -1 +0,0 @@
Fix parsing of Content-Disposition headers on remote media requests and URL previews.

View file

@ -1 +0,0 @@
Minor docstring fixes for MatrixFederationAgent.

View file

@ -1 +0,0 @@
Optimise EDU transmission for the federation_sender worker.

View file

@ -1 +0,0 @@
Update test_typing to use HomeserverTestCase.

View file

@ -1 +0,0 @@
Add an endpoint to the admin API for querying the server version. Contributed by Joseph Weston.

View file

@ -1 +0,0 @@
Fix incorrect log about not persisting duplicate state event.

View file

@ -1 +0,0 @@
Update URLs for riot.im icons and logos in the default notification templates.

View file

@ -1 +0,0 @@
Fix v4v6 option in HAProxy example config. Contributed by Flakebi.

View file

@ -1 +0,0 @@
Include a default configuration file in the 'docs' directory.

View file

@ -1 +0,0 @@
Handle batch updates in worker replication protocol.

View file

@ -1 +0,0 @@
Synapse is now permissive about trailing slashes on some of its federation endpoints, allowing zero or more to be present.

View file

@ -1 +0,0 @@
Removed unnecessary $ from some federation endpoint path regexes.

View file

@ -1 +0,0 @@
Remove link to deleted title in README.

View file

@ -1 +0,0 @@
Add support for /keys/query and /keys/changes REST endpoints to client_reader worker.

View file

@ -1 +0,0 @@
Clean up read-receipt handling.

View file

@ -1 +0,0 @@
Add some debug about processing read receipts.

View file

@ -1 +0,0 @@
Clean up some replication code.

View file

@ -1 +0,0 @@
Include a default configuration file in the 'docs' directory.

View file

@ -1 +0,0 @@
Add configurable rate limiting to the /register endpoint.

View file

@ -1 +0,0 @@
Add checks to incoming events over federation for events evading auth (aka "soft fail").

View file

@ -1 +0,0 @@
Add some docstrings.

View file

@ -1 +0,0 @@
Add debug logger to try and track down #4422.

View file

@ -1 +0,0 @@
Make shutdown API send explanation message to room after users have been forced joined.

View file

@ -1 +0,0 @@
Fix bug where we didn't correctly throttle sending of USER_IP commands over replication.

View file

@ -1 +0,0 @@
Update example_log_config.yaml.

View file

@ -1 +0,0 @@
Add configurable rate limiting to the /login endpoint.

View file

@ -1 +0,0 @@
Document the `generate` option for the docker image.

View file

@ -1 +0,0 @@
Fix check-newsfragment for debian-only changes.

View file

@ -1 +0,0 @@
Add some debug logging for device list updates to help with #4828.

View file

@ -1 +0,0 @@
Fix potential race in handling missing updates in device list updates.

View file

@ -1 +0,0 @@
Improve federation documentation, specifically .well-known support. Many thanks to @vaab.

View file

@ -1 +0,0 @@
Fix bug where synapse expected an un-specced `prev_state` field on state events.

View file

@ -1 +0,0 @@
Transfer a user's notification settings (push rules) on room upgrade.

View file

@ -1 +0,0 @@
Disable captcha registration by default in unit tests.

View file

@ -1 +0,0 @@
Remove trailing slashes from certain outbound federation requests. Retry if receiving a 404. Context: #3622.

View file

@ -1 +0,0 @@
Add stuff back to the .gitignore.

View file

@ -1 +0,0 @@
Clarify what registration_shared_secret allows for.

View file

@ -1 +0,0 @@
The user directory has been rewritten to make it faster, with less chance of falling behind on a large server.

View file

@ -1 +0,0 @@
Correctly log expected errors when fetching server keys.

View file

@ -1 +0,0 @@
Update install docs to explicitly state a full-chain (not just the top-level) TLS certificate must be provided to Synapse. This caused some people's Synapse ports to appear correct in a browser but still (rightfully so) upset the federation tester.

View file

@ -1 +0,0 @@
Move client read-receipt processing to federation sender worker.

View file

@ -1 +0,0 @@
Allow passing --daemonize flags to workers in the same way as with master.

View file

@ -1 +0,0 @@
Refactor federation TransactionQueue.

View file

@ -1 +0,0 @@
Comment out most options in the generated config.

View file

@ -1 +0,0 @@
The user directory has been rewritten to make it faster, with less chance of falling behind on a large server.

View file

@ -1 +0,0 @@
Add configurable rate limiting to the /login endpoint.

View file

@ -1 +0,0 @@
Fix yaml library warnings by using safe_load.

View file

@ -1 +0,0 @@
Update Apache setup to remove location syntax. Thanks to @cwmke!

View file

@ -1 +0,0 @@
Reinstate test case that runs unit tests against oldest supported dependencies.

View file

@ -1 +0,0 @@
Update link to federation docs.

View file

@ -1 +0,0 @@
fix test_auto_create_auto_join_where_no_consent.

View file

@ -1 +0,0 @@
fix test_auto_create_auto_join_where_no_consent.

View file

@ -1 +0,0 @@
The user directory has been rewritten to make it faster, with less chance of falling behind on a large server.

View file

@ -1,2 +0,0 @@
Fix a bug where hs_disabled_message was sometimes not correctly enforced.

View file

@ -1 +0,0 @@
Use a regular HomeServerConfig object for unit tests rater than a Mock.

View file

@ -1 +0,0 @@
Batch up outgoing read-receipts to reduce federation traffic.

View file

@ -1 +0,0 @@
Add option to disable searching the user directory.

View file

@ -1 +0,0 @@
Add some notes about tuning postgres for larger deployments.

View file

@ -1 +0,0 @@
Add option to disable searching of local and remote public room lists.

View file

@ -1 +0,0 @@
The user directory has been rewritten to make it faster, with less chance of falling behind on a large server.

View file

@ -1 +0,0 @@
Add a config option for torture-testing worker replication.

View file

@ -1 +0,0 @@
Fix bug in shutdown room admin API where it would fail if a user in the room hadn't consented to the privacy policy.

View file

@ -1 +0,0 @@
Log requests which are simulated by the unit tests.

View file

@ -1 +0,0 @@
Fix bug where blocked world-readable rooms were still peekable.

View file

@ -1 +0,0 @@
Allow newsfragments to end with exclamation marks. Exciting!

View file

@ -1 +0,0 @@
Refactor some more tests to use HomeserverTestCase.

View file

@ -1 +0,0 @@
Refactor out the state deltas portion of the user directory store and handler.

View file

@ -1 +0,0 @@
Fix nginx example in ACME doc.

View file

@ -1 +0,0 @@
Batch up outgoing read-receipts to reduce federation traffic.

View file

@ -1 +0,0 @@
Use an explicit dbname for postgres connections in the tests.

View file

@ -1 +0,0 @@
Fix `ClientReplicationStreamProtocol.__str__()`.

View file

@ -1 +0,0 @@
Add ability for password providers to login/register a user via 3PID (email, phone).

View file

@ -1 +0,0 @@
The user directory has been rewritten to make it faster, with less chance of falling behind on a large server.

1
changelog.d/4954.misc Normal file
View file

@ -0,0 +1 @@
Refactor replication row generation/parsing.

1
changelog.d/4955.bugfix Normal file
View file

@ -0,0 +1 @@
Fix sync bug which made accepting invites unreliable in worker-mode synapses.

1
changelog.d/4965.misc Normal file
View file

@ -0,0 +1 @@
Remove log line for password via the admin API.

1
changelog.d/4968.misc Normal file
View file

@ -0,0 +1 @@
Fix typo in TLS filenames in docker/README.md. Also add the '-p' commandline option to the 'docker run' example. Contributed by Jurrie Overgoor.

2
changelog.d/4969.misc Normal file
View file

@ -0,0 +1,2 @@
Refactor room version definitions.

1
changelog.d/4981.bugfix Normal file
View file

@ -0,0 +1 @@
start.sh: Fix the --no-rate-limit option for messages and make it bypass rate limit on registration and login too.

8
debian/changelog vendored
View file

@ -1,8 +1,12 @@
matrix-synapse-py3 (0.99.3) UNRELEASED; urgency=medium
matrix-synapse-py3 (0.99.3) stable; urgency=medium
[ Richard van der Hoff ]
* Fix warning during preconfiguration. (Fixes: #4819)
-- Richard van der Hoff <richard@matrix.org> Thu, 07 Mar 2019 07:17:00 +0000
[ Synapse Packaging team ]
* New synapse release 0.99.3.
-- Synapse Packaging team <packages@matrix.org> Mon, 01 Apr 2019 12:48:21 +0000
matrix-synapse-py3 (0.99.2) stable; urgency=medium

View file

@ -27,16 +27,26 @@ for port in 8080 8081 8082; do
--config-path "$DIR/etc/$port.config" \
--report-stats no
printf '\n\n# Customisation made by demo/start.sh\n' >> $DIR/etc/$port.config
echo 'enable_registration: true' >> $DIR/etc/$port.config
# Check script parameters
if [ $# -eq 1 ]; then
if [ $1 = "--no-rate-limit" ]; then
# Set high limits in config file to disable rate limiting
perl -p -i -e 's/rc_messages_per_second.*/rc_messages_per_second: 1000/g' $DIR/etc/$port.config
perl -p -i -e 's/rc_message_burst_count.*/rc_message_burst_count: 1000/g' $DIR/etc/$port.config
fi
fi
# messages rate limit
echo 'rc_messages_per_second: 1000' >> $DIR/etc/$port.config
echo 'rc_message_burst_count: 1000' >> $DIR/etc/$port.config
perl -p -i -e 's/^enable_registration:.*/enable_registration: true/g' $DIR/etc/$port.config
# registration rate limit
printf 'rc_registration:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
# login rate limit
echo 'rc_login:' >> $DIR/etc/$port.config
printf ' address:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
printf ' account:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
printf ' failed_attempts:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
fi
fi
if ! grep -F "full_twisted_stacktraces" -q $DIR/etc/$port.config; then
echo "full_twisted_stacktraces: true" >> $DIR/etc/$port.config

View file

@ -31,6 +31,7 @@ docker run \
--mount type=volume,src=synapse-data,dst=/data \
-e SYNAPSE_SERVER_NAME=my.matrix.host \
-e SYNAPSE_REPORT_STATS=yes \
-p 8448:8448 \
matrixdotorg/synapse:latest
```
@ -57,8 +58,8 @@ configuration file there. Multiple application services are supported.
Synapse requires a valid TLS certificate. You can do one of the following:
* Provide your own certificate and key (as
`${DATA_PATH}/${SYNAPSE_SERVER_NAME}.crt` and
`${DATA_PATH}/${SYNAPSE_SERVER_NAME}.key`, or elsewhere by providing an
`${DATA_PATH}/${SYNAPSE_SERVER_NAME}.tls.crt` and
`${DATA_PATH}/${SYNAPSE_SERVER_NAME}.tls.key`, or elsewhere by providing an
entire config as `${SYNAPSE_CONFIG_PATH}`).
* Use a reverse proxy to terminate incoming TLS, and forward the plain http

View file

@ -27,4 +27,4 @@ try:
except ImportError:
pass
__version__ = "0.99.2"
__version__ = "0.99.3"

View file

@ -102,46 +102,6 @@ class ThirdPartyEntityKind(object):
LOCATION = "location"
class RoomVersions(object):
V1 = "1"
V2 = "2"
V3 = "3"
STATE_V2_TEST = "state-v2-test"
class RoomDisposition(object):
STABLE = "stable"
UNSTABLE = "unstable"
# the version we will give rooms which are created on this server
DEFAULT_ROOM_VERSION = RoomVersions.V1
# vdh-test-version is a placeholder to get room versioning support working and tested
# until we have a working v2.
KNOWN_ROOM_VERSIONS = {
RoomVersions.V1,
RoomVersions.V2,
RoomVersions.V3,
RoomVersions.STATE_V2_TEST,
RoomVersions.V3,
}
class EventFormatVersions(object):
"""This is an internal enum for tracking the version of the event format,
independently from the room version.
"""
V1 = 1
V2 = 2
KNOWN_EVENT_FORMAT_VERSIONS = {
EventFormatVersions.V1,
EventFormatVersions.V2,
}
ServerNoticeMsgType = "m.server_notice"
ServerNoticeLimitReached = "m.server_notice.usage_limit_reached"

View file

@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
# Copyright 2019 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import attr
class EventFormatVersions(object):
"""This is an internal enum for tracking the version of the event format,
independently from the room version.
"""
V1 = 1 # $id:server format
V2 = 2 # MSC1659-style $hash format: introduced for room v3
KNOWN_EVENT_FORMAT_VERSIONS = {
EventFormatVersions.V1,
EventFormatVersions.V2,
}
class StateResolutionVersions(object):
"""Enum to identify the state resolution algorithms"""
V1 = 1 # room v1 state res
V2 = 2 # MSC1442 state res: room v2 and later
class RoomDisposition(object):
STABLE = "stable"
UNSTABLE = "unstable"
@attr.s(slots=True, frozen=True)
class RoomVersion(object):
"""An object which describes the unique attributes of a room version."""
identifier = attr.ib() # str; the identifier for this version
disposition = attr.ib() # str; one of the RoomDispositions
event_format = attr.ib() # int; one of the EventFormatVersions
state_res = attr.ib() # int; one of the StateResolutionVersions
class RoomVersions(object):
V1 = RoomVersion(
"1",
RoomDisposition.STABLE,
EventFormatVersions.V1,
StateResolutionVersions.V1,
)
STATE_V2_TEST = RoomVersion(
"state-v2-test",
RoomDisposition.UNSTABLE,
EventFormatVersions.V1,
StateResolutionVersions.V2,
)
V2 = RoomVersion(
"2",
RoomDisposition.STABLE,
EventFormatVersions.V1,
StateResolutionVersions.V2,
)
V3 = RoomVersion(
"3",
RoomDisposition.STABLE,
EventFormatVersions.V2,
StateResolutionVersions.V2,
)
# the version we will give rooms which are created on this server
DEFAULT_ROOM_VERSION = RoomVersions.V1
KNOWN_ROOM_VERSIONS = {
v.identifier: v for v in (
RoomVersions.V1,
RoomVersions.V2,
RoomVersions.V3,
RoomVersions.STATE_V2_TEST,
)
} # type: dict[str, RoomVersion]

View file

@ -48,6 +48,7 @@ from synapse.replication.slave.storage.receipts import SlavedReceiptsStore
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
from synapse.replication.slave.storage.room import RoomStore
from synapse.replication.tcp.client import ReplicationClientHandler
from synapse.replication.tcp.streams.events import EventsStreamEventRow
from synapse.rest.client.v1 import events
from synapse.rest.client.v1.initial_sync import InitialSyncRestServlet
from synapse.rest.client.v1.room import RoomInitialSyncRestServlet
@ -369,7 +370,9 @@ class SyncReplicationHandler(ReplicationClientHandler):
# We shouldn't get multiple rows per token for events stream, so
# we don't need to optimise this for multiple rows.
for row in rows:
event = yield self.store.get_event(row.event_id)
if row.type != EventsStreamEventRow.TypeId:
continue
event = yield self.store.get_event(row.data.event_id)
extra_users = ()
if event.type == EventTypes.Member:
extra_users = (event.state_key,)

Some files were not shown because too many files have changed in this diff Show more