Commit graph

23971 commits

Author SHA1 Message Date
Eric Eastwood
830e09d2de Grab prev_membership to see whether the server left the room (fixes tests)
See https://github.com/element-hq/synapse/pull/17320#discussion_r1657170493

`prev_membership` helps determine whether we should include the `event_id=null` row because
we can check whether we have already left.

 - When we leave the room causing the server to leave the room, the `prev_event_id` will be our join event
 - When the server leaves the room after us, the `prev_event_id` will be leave event
 - In the state reset case, `prev_event_id` will be our join event
2024-06-27 10:20:33 -05:00
Eric Eastwood
956f20ef74 (currently failing) Add test to make sure membership changes don't re-appear if the server leaves the room later 2024-06-27 01:24:37 -05:00
Eric Eastwood
f163fcf08a Remove need for topological_ordering 2024-06-27 01:21:49 -05:00
Eric Eastwood
935b98c474 All get_current_state_delta_membership_changes_for_user(...) tests passing 2024-06-27 00:49:51 -05:00
Eric Eastwood
7eb1806ee3 Fix lints 2024-06-26 21:06:05 -05:00
Eric Eastwood
b7914e7676 Add skipped test for state resets 2024-06-26 21:01:54 -05:00
Eric Eastwood
8df39d1baf Remove redundant instance_name column 2024-06-26 20:22:03 -05:00
Eric Eastwood
2a944ffcef Add state of the db in each situation 2024-06-26 20:20:17 -05:00
Eric Eastwood
48d0acfbcd Actually test get_current_state_delta_membership_changes_for_user(...) in remote join test 2024-06-26 19:52:12 -05:00
Eric Eastwood
0b9a903ca1 Add test that remotely joins room 2024-06-26 19:35:18 -05:00
Eric Eastwood
ec2d8dc1e3 Create events using helper 2024-06-26 18:52:24 -05:00
Eric Eastwood
2bf39231ed Add some tests for get_current_state_delta_membership_changes_for_user(...) 2024-06-26 18:40:36 -05:00
Eric Eastwood
7395e10420 Fix builtins.SyntaxError: EOL while scanning string literal (test_sync.py, line 1885)
See https://github.com/element-hq/synapse/actions/runs/9675073109/job/26692003103?pr=17320#step:9:5552

Worked fine locally but failed in CI with Python 3.8
2024-06-26 02:19:31 -05:00
Eric Eastwood
11db1befa2 Remove debug log 2024-06-26 02:05:25 -05:00
Eric Eastwood
c60aca755b Fix clause change 2024-06-26 02:02:34 -05:00
Eric Eastwood
5c213158d7 Merge branch 'develop' into madlittlemods/sliding-sync-room-data
Conflicts:
	tests/rest/client/test_sync.py
2024-06-26 01:36:23 -05:00
Eric Eastwood
39259f66fa Join both tables with stream_ordering 2024-06-26 01:16:46 -05:00
Eric Eastwood
62c6a4e860 Add newly_joined support to get_sync_room_ids_for_user(...) 2024-06-26 01:10:00 -05:00
Eric Eastwood
cccbd15e7e Refactor back to not pulling out full events 2024-06-25 23:40:55 -05:00
Eric Eastwood
daa7e3691a Add docstring 2024-06-25 23:01:28 -05:00
Eric Eastwood
d91aa0018c Remove extras 2024-06-25 22:45:59 -05:00
Eric Eastwood
fb8fbd489c Just fetch full events for get_current_state_delta_membership_changes_for_user(...)
Makes downstream logic simpler and although we may look-up some events
we don't use, the lookup is all done in one go instead of fetching events
from event_ids in a couple different places.
2024-06-25 22:37:45 -05:00
Eric Eastwood
27d74b023e Iterate 2024-06-25 22:20:27 -05:00
Eric Eastwood
6c791a88b3 WIP: Add back newly_left 2024-06-25 21:07:19 -05:00
Eric Eastwood
fbd92e1c9d Add get_current_state_delta_membership_changes_for_user(...) (using current_state_delta_stream)
(still need to add newly_left rooms back)
2024-06-25 20:16:50 -05:00
Eric Eastwood
83d6f76606 Describe current_state_delta_stream better 2024-06-25 15:27:49 -05:00
Eric Eastwood
4c22131442 Start testing for the correct room membership (failing) 2024-06-25 15:27:43 -05:00
Eric Eastwood
303d834b78 Add tracking discussion for not optional in the future 2024-06-25 12:38:09 -05:00
Eric Eastwood
e3e431fab4 Finish up stripped_state for invite rooms
See https://github.com/element-hq/synapse/pull/17320#discussion_r1646581077
2024-06-25 12:35:50 -05:00
Eric Eastwood
7aea406c22 Just stripped_state for invite rooms 2024-06-25 11:18:27 -05:00
Andrew Morgan
ef7fbdfebd
Fixes to the table of contents in the README (#17329) 2024-06-25 15:20:59 +00:00
Denis Kasak
9cf0ef9c70
Fix outdated Security Disclosure Policy references (#17341) 2024-06-25 15:58:30 +01:00
Shay
a023538822
Re-introduce federation /download endpoint (#17350) 2024-06-25 14:35:37 +00:00
douglaz
f79dbd0f61
Fix refreshable_access_token_lifetime typo (#17357)
Simple typo in the docs
2024-06-25 12:07:13 +01:00
Erik Johnston
c89fea3fd1
Limit amount of replication we send (#17358)
Fixes up #17333, where we failed to actually send less data (the
`DISTINCT` didn't work due to `stream_id` being different).

We fix this by making it so that every device list outbound poke for a
given user ID has the same stream ID. We can't change the query to only
return e.g. max stream ID as the receivers look up the destinations to
send to by doing `SELECT WHERE stream_id = ?`
2024-06-25 11:17:39 +01:00
Erik Johnston
554a92601a
Reintroduce "Reduce device lists replication traffic."" (#17361)
Reintroduces https://github.com/element-hq/synapse/pull/17333


Turns out the reason for revert was down two master instances running
2024-06-25 10:34:34 +01:00
Erik Johnston
a98cb87bee
Revert "Reduce device lists replication traffic." (#17360)
Reverts element-hq/synapse#17333

It looks like master was still sending out replication RDATA with the
old format... somehow
2024-06-25 09:57:34 +01:00
Eric Eastwood
3568311989 Fix spelling typo 2024-06-24 19:08:18 -05:00
Eric Eastwood
6e8af83193
Add is_invite filtering to Sliding Sync /sync (#17335)
Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
2024-06-24 19:07:56 -05:00
Eric Eastwood
21ca02c5ad newly_joined vs limited already being tracked in a discussion
See https://github.com/element-hq/synapse/pull/17320#discussion_r1646579623
if anything comes out of it.
2024-06-24 16:08:58 -05:00
Eric Eastwood
0e71a2f2d1 Add TODO for filtering call invites in public rooms 2024-06-24 15:56:27 -05:00
devonh
805e6c9a8f
Correct error in user_directory docs (#17348)
### Pull Request Checklist

<!-- Please read
https://element-hq.github.io/synapse/latest/development/contributing_guide.html
before submitting your pull request -->

* [X] Pull request is based on the develop branch
* [X] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog).
The entry should:
- Be a short description of your change which makes sense to users.
"Fixed a bug that prevented receiving messages from other servers."
instead of "Moved X method from `EventStore` to `EventWorkerStore`.".
  - Use markdown where necessary, mostly for `code blocks`.
  - End with either a period (.) or an exclamation mark (!).
  - Start with a capital letter.
- Feel free to credit yourself, by adding a sentence "Contributed by
@github_username." or "Contributed by [Your Name]." to the end of the
entry.
* [X] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html) is
correct
(run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))

---------

Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
Co-authored-by: reivilibre <oliverw@matrix.org>
2024-06-24 17:18:58 +00:00
devonh
3c61ddbbc9
Add default values for rc_invites per_issuer to docs (#17347)
A simple change to update the docs where default values were missing.

### Pull Request Checklist

<!-- Please read
https://element-hq.github.io/synapse/latest/development/contributing_guide.html
before submitting your pull request -->

* [X] Pull request is based on the develop branch
* [X] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog).
The entry should:
- Be a short description of your change which makes sense to users.
"Fixed a bug that prevented receiving messages from other servers."
instead of "Moved X method from `EventStore` to `EventWorkerStore`.".
  - Use markdown where necessary, mostly for `code blocks`.
  - End with either a period (.) or an exclamation mark (!).
  - Start with a capital letter.
- Feel free to credit yourself, by adding a sentence "Contributed by
@github_username." or "Contributed by [Your Name]." to the end of the
entry.
* [X] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html) is
correct
(run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))

---------

Co-authored-by: Kim Brose <2803622+HarHarLinks@users.noreply.github.com>
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2024-06-24 17:16:09 +00:00
Eric Eastwood
87fac19fde Fix lints
See https://github.com/element-hq/synapse/pull/17320#discussion_r1647701997

```
synapse/federation/federation_server.py:677: error: Cannot determine type of "_join_rate_per_room_limiter"  [has-type]
synapse/federation/federation_server.py:720: error: Cannot determine type of "_join_rate_per_room_limiter"  [has-type]
```
2024-06-24 10:15:15 -05:00
Eric Eastwood
b1b4231ccb Merge branch 'develop' into madlittlemods/sliding-sync-room-data 2024-06-24 10:12:05 -05:00
Eric Eastwood
ae4c236a6d
Fix room type typo in mailer (#17336)
Correct event content field is `EventContentFields.ROOM_TYPE` (`type`)  , not `room_type` 

Spec: https://spec.matrix.org/v1.10/client-server-api/#mroomcreate
2024-06-24 10:02:16 -05:00
Erik Johnston
930a64b6c1
Reintroduce #17291. (#17338)
This is #17291 (which got reverted), with some added fixups, and change
so that tests actually pick up the error.

The problem was that we were not calculating any new chain IDs due to a
missing `not` in a condition.
2024-06-24 14:40:28 +00:00
Shay
7a11c0ac4f
Add support for MSC3823 - Account Suspension Part 2 (#17255) 2024-06-24 14:21:22 +01:00
Erik Johnston
cf711ac03c
Reduce device lists replication traffic. (#17333)
Reduce the replication traffic of device lists, by not sending every
destination that needs to be sent the device list update over
replication. Instead a "hosts to send to have been calculated"
notification over replication, and then federation senders read the
destinations from the DB.

For non federation senders this should heavily reduce the impact of a
user in many large rooms changing a device.
2024-06-24 14:15:13 +01:00
Denis Kasak
700d2cc4a0
Tidy up integer parsing (#17339)
The parse_integer function was previously made to reject negative values by
default in https://github.com/element-hq/synapse/pull/16920, but the
documentation stated otherwise. This fixes the documentation and also:

- Removes explicit negative=False parameters from call sites.
- Brings the negative default of parse_integer_from_args in alignment with
  parse_integer.
2024-06-24 15:12:14 +02:00