Tulir Asokan
ef43d4495a
Merge remote-tracking branch 'upstream/release-v1.110'
2024-06-26 17:35:50 +03:00
Richard van der Hoff
2c36a679ae
Include user membership on events ( #17282 )
...
MSC4115 has now completed FCP, so we can enable it by default and switch
to the stable identifier.
2024-06-13 21:45:54 +00:00
Eric Eastwood
265ee88f34
Wrong retention policy being used when filtering events (lint ControlVarUsedAfterBlockViolation
WPS441
) ( #17272 )
...
Fix loop var being used outside block.
Before this change, we were always using the last room_id's retention policy for all events being filtered.
I found this bug with the [new lint rule, `ControlVarUsedAfterBlockViolation` `WPS441`](https://github.com/astral-sh/ruff/pull/11769 ), that I re-implemented in `ruff`. Shout-out to @reivilibre for all the help in the beginning!
### 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 ))
2024-06-10 09:48:38 -05:00
Tulir Asokan
6f07fc4e00
Merge remote-tracking branch 'upstream/release-v1.107'
2024-05-10 19:19:53 +03:00
Richard van der Hoff
b548f7803a
Add support for MSC4115 ( #17104 )
...
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2024-04-29 15:22:13 +01:00
Tulir Asokan
67b2fad49e
Merge remote-tracking branch 'upstream/release-v1.104'
2024-03-26 16:24:35 +02:00
dependabot[bot]
1e68b56a62
Bump black from 23.10.1 to 24.2.0 ( #16936 )
2024-03-13 16:46:44 +00:00
Tulir Asokan
b07561405c
Allow unhiding events that the C-S API filters away by default
2024-01-23 19:08:15 +02:00
Erik Johnston
23740eaa3d
Correctly mention previous copyright ( #16820 )
...
During the migration the automated script to update the copyright
headers accidentally got rid of some of the existing copyright lines.
Reinstate them.
2024-01-23 11:26:48 +00:00
Patrick Cloke
8e1e62c9e0
Update license headers
2023-11-21 15:29:58 -05:00
Patrick Cloke
d38d0dffc9
Use StrCollection in additional places. ( #16301 )
2023-09-13 07:57:19 -04:00
Patrick Cloke
ad3f43be9a
Run pyupgrade for python 3.7 & 3.8. ( #16110 )
2023-08-15 08:11:20 -04:00
Eric Eastwood
30a5076da8
Log when events are (unexpectedly) filtered out of responses in tests ( #14213 )
...
See https://github.com/matrix-org/synapse/pull/14095#discussion_r990335492
This is useful because when see that a relevant event is an `outlier` or `soft-failed`, then that's a good unexpected indicator explaining why it's not showing up. `filter_events_for_client` is used in `/sync`, `/messages`, `/context` which are all common end-to-end assertion touch points (also notifications, relations).
2023-06-01 21:27:18 -05:00
David Robertson
4bb26c95a9
Refactor filter_events_for_server
( #15240 )
...
* Tweak docstring and type hint
* Flip logic and provide better name
* Separate decision from action
* Track a set of strings, not EventBases
* Require explicit boolean options from callers
* Add explicit option for partial state rooms
* Changelog
* Rename param
2023-03-10 15:31:25 +00:00
David Robertson
b5b5f66084
Move StateFilter
to synapse.types
( #14668 )
...
* Move `StateFilter` to `synapse.types`
* Changelog
2022-12-12 16:19:30 +00:00
Mathieu Velten
1526ff389f
Faster joins: filter out non local events when a room doesn't have its full state ( #14404 )
...
Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
2022-11-21 16:46:14 +01:00
Eric Eastwood
2c63cdcc3f
Add debug logs to figure out why an event was filtered ( #14095 )
...
Spawned while investigating https://github.com/matrix-org/synapse/issues/13944
This way we might get some more context whenever an `403 Forbidden - body: {"errcode":"M_FORBIDDEN","error":"You don't have permission to access that event."}` error is produced.
`log_config.yaml`
```yaml
loggers:
synapse:
level: INFO
synapse.visibility:
level: DEBUG
```
2022-10-17 16:02:39 -05:00
Erik Johnston
535f8c8f7d
Skip filtering during push if there are no push actions ( #13992 )
2022-09-30 17:40:33 +01:00
Sean Quah
51c01d450a
Add some miscellaneous comments around sync ( #13474 )
...
Add some miscellaneous comments to document sync, especially around
`compute_state_delta`.
Signed-off-by: Sean Quah <seanq@matrix.org>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-08-10 12:58:20 +01:00
Eric Eastwood
92d21faf12
Instrument /messages
for understandable traces in Jaeger ( #13368 )
...
In Jaeger:
- Before: huge list of uncategorized database calls
- After: nice and collapsible into units of work
2022-08-03 10:57:38 -05:00
Erik Johnston
e610128c50
Add a filter_event_for_clients_with_state
function ( #13222 )
2022-07-11 14:14:09 +01:00
Richard van der Hoff
79dadf7216
Fix 404 on /sync
when the last event is a redaction of an unknown/purged event ( #12905 )
...
Currently, we try to pull the event corresponding to a sync token from the database. However, when
we fetch redaction events, we check the target of that redaction (because we aren't allowed to send
redactions to clients without validating them). So, if the sync token points to a redaction of an event
that we don't have, we have a problem.
It turns out we don't really need that event, and can just work with its ID and metadata, which
sidesteps the whole problem.
2022-06-01 11:29:51 +00:00
Erik Johnston
1e453053cb
Rename storage classes ( #12913 )
2022-05-31 12:17:50 +00:00
Brendan Abolivier
4cc4229cd7
Prevent expired events from being filtered out when retention is disabled ( #12611 )
...
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-05-23 17:18:23 +00:00
Richard van der Hoff
17d99f758a
Optimise backfill calculation ( #12522 )
...
Try to avoid an OOM by checking fewer extremities.
Generally this is a big rewrite of _maybe_backfill, to try and fix some of the TODOs and other problems in it. It's best reviewed commit-by-commit.
2022-04-26 10:27:11 +01:00
Richard van der Hoff
6927d87254
Handle outliers in /federation/v1/event
( #12332 )
...
The intention here is to avoid doing state lookups for outliers in
`/_matrix/federation/v1/event`. Unfortunately that's expanded into something of
a rewrite of `filter_events_for_server`, which ended up trying to do that
operation in a couple of places.
2022-03-31 17:39:34 +00:00
Patrick Cloke
dda9b7fc4d
Use the ignored_users table to test event visibility & sync. ( #12225 )
...
Instead of fetching the raw account data and re-parsing it. The
ignored_users table is a denormalised version of the account data
for quick searching.
2022-03-15 14:06:05 -04:00
Richard van der Hoff
87c230c27c
Update client-visibility filtering for outlier events ( #12155 )
...
Avoid trying to get the state for outliers, which isn't a sensible thing to do.
2022-03-04 10:31:19 +00:00
reivilibre
4c2096599c
Make the get_global_account_data_by_type_for_user
cache be a tree-cache whose key is prefixed with the user ID ( #11788 )
2022-01-21 08:38:36 +00:00
Jonathan de Jong
95e47b2e78
[pyupgrade] synapse/
( #10348 )
...
This PR is tantamount to running
```
pyupgrade --py36-plus --keep-percent-format `find synapse/ -type f -name "*.py"`
```
Part of #9744
2021-07-19 15:28:05 +01:00
Jonathan de Jong
bf72d10dbf
Use inline type hints in various other places (in synapse/
) ( #10380 )
2021-07-15 11:02:43 +01:00
Jonathan de Jong
4b965c862d
Remove redundant "coding: utf-8" lines ( #9786 )
...
Part of #9744
Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now.
`Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
2021-04-14 15:34:27 +01:00
Patrick Cloke
af387cf52a
Add type hints to misc. files. ( #9676 )
2021-03-24 06:49:01 -04:00
David Teller
b0b2cac057
Merge pull request #9150 from Yoric/develop-context
...
New API /_synapse/admin/rooms/{roomId}/context/{eventId}
2021-02-08 15:53:44 +01:00
Tim Gates
e1943d1353
Typo fix in a comment: subequently -> subsequently. ( #8988 )
2021-02-03 07:24:53 -05:00
David Teller
de7f049527
FIXUP: Don't filter events at all for admin/v1/rooms/.../context/...
2021-01-28 12:31:07 +01:00
David Teller
10332c175c
New API /_synapse/admin/rooms/{roomId}/context/{eventId}
...
Signed-off-by: David Teller <davidt@element.io>
2021-01-28 12:29:49 +01:00
Erik Johnston
70586aa63e
Try and drop stale extremities. ( #8929 )
...
If we see stale extremities while persisting events, and notice that
they don't change the result of state resolution, we drop them.
2020-12-18 09:49:18 +00:00
Patrick Cloke
be2db93b3c
Do not assume that the contents dictionary includes history_visibility. ( #8945 )
2020-12-16 08:46:37 -05:00
Patrick Cloke
c5251c6fbd
Do not assume that account data is of the correct form. ( #8454 )
...
This fixes a bug where `m.ignored_user_list` was assumed to be a dict,
leading to odd behavior for users who set it to something else.
2020-10-05 09:28:05 -04:00
Patrick Cloke
5f65e62681
Convert groups and visibility code to async / await. ( #7951 )
2020-07-27 12:32:08 -04:00
Patrick Cloke
38e1fac886
Fix some spelling mistakes / typos. ( #7811 )
2020-07-09 09:52:58 -04:00
Dagfinn Ilmari Mannsåker
a3f11567d9
Replace all remaining six usage with native Python 3 equivalents ( #7704 )
2020-06-16 08:51:47 -04:00
Patrick Cloke
bd6dc17221
Replace iteritems/itervalues/iterkeys with native versions. ( #7692 )
2020-06-15 07:03:36 -04:00
Brendan Abolivier
8120a238a4
Refactor a bit
2020-03-11 18:49:41 +00:00
Brendan Abolivier
37a9873f63
Also don't fail on aliases events in this case
2020-03-11 18:43:41 +00:00
Brendan Abolivier
e38c44b418
Lint
2020-03-11 18:06:07 +00:00
Brendan Abolivier
2dce68c651
Also don't filter out events sent by ignored users when checking state visibility
2020-03-11 17:53:22 +00:00
Brendan Abolivier
9c0775e86a
Fix condition
2020-03-11 17:53:18 +00:00
Brendan Abolivier
69ce55c510
Don't filter out dummy events when we're checking the visibility of state
2020-03-11 17:52:54 +00:00