1
0
Commit Graph

19903 Commits

Author SHA1 Message Date
Andrew Morgan 2a0eabbee3 squash into 'and use everywhere' 2021-12-09 18:41:19 +00:00
Andrew Morgan 34eacf7f2d squash into move DeviceLists commit 2021-12-09 18:39:02 +00:00
Andrew Morgan b4336fc9e0 squash into 'and use everywhere' 2021-12-09 18:37:50 +00:00
Andrew Morgan ba5f501b4b Support sending device lists everywhere; needs cleaning up 2021-12-09 18:36:55 +00:00
Andrew Morgan 8e8ba360c9 Squash into "and use everywhere" 2021-12-09 18:36:31 +00:00
Andrew Morgan 842c2994f5 fix tests for device lists 2021-12-09 18:35:59 +00:00
Andrew Morgan feeecea603 Create ApplicationService.is_interested_in_user, and use everywhere 2021-12-09 18:27:59 +00:00
Andrew Morgan 0f9a425797 Switch DeviceLists to containing Sets, as we'll need a type that we can delete items from 2021-12-09 17:53:39 +00:00
Andrew Morgan f1f88172d8 Move DeviceLists type to synapse.types
Such that we can use it elsewhere.
2021-12-08 18:36:17 +00:00
Andrew Morgan c7ad734b56 Fix up database method to grab device list changes - bit dirty 2021-12-08 18:30:52 +00:00
Andrew Morgan b399104827 Add device_list as one of the supported streams set_type 2021-12-08 18:30:52 +00:00
Andrew Morgan cf7e65968f wip: get device lists working squashme 2021-12-08 18:30:52 +00:00
Andrew Morgan 3ba63398af migration delta to track device_list stream id per appservice 2021-12-08 18:30:52 +00:00
Andrew Morgan 967755d574 Fix calling is_interested_in_event with store. 2021-12-08 18:30:52 +00:00
Andrew Morgan a48f817642 wip: get device lists working
still need a way to put them in the top-level of the transaction json
2021-12-08 18:30:52 +00:00
Andrew Morgan 6daab0f935 is_interested_in_room public 2021-12-08 18:30:52 +00:00
Andrew Morgan b80db21c19 Add some caching to interest methods
This also fixes (I believe) is_interested_in_presence, the cache of which was
never invalidated.

Note that namespaces can only be changed via a server restart. Users
leaving and joining rooms do change on the fly though.
2021-12-08 18:30:52 +00:00
Andrew Morgan a58d3bdd5e Refactor appservice interest-checking methods
This commit refactors the methods of an application service which can
be used to determine whether an appservice is interested in a given
user, event or room. We now have the following list of functions:

is_user_in_namespace
is_room_alias_in_namespace
is_room_id_in_namespace

is_interested_in_event
is_interested_in_room

Which is clearer than before. There is no `is_interested_in_user`, as
it would be equivalent to is_user_in_namespace.
2021-12-08 18:30:52 +00:00
Andrew Morgan 6517bd15ac Clean up reference to homeserver store 2021-12-08 18:30:52 +00:00
Andrew Morgan be13f6d798 rename ApplicationService.is_interested_in_room_id -> is_room_id_in_namespace 2021-12-08 18:30:52 +00:00
Andrew Morgan 05d0ed8151 rename ApplicationService.is_interested_in_alias -> is_room_alias_in_namespace 2021-12-08 18:30:52 +00:00
Andrew Morgan a193804162 rename ApplicationService.is_interested_in_user -> is_user_in_namespace 2021-12-08 18:30:52 +00:00
Andrew Morgan d7dc699f0a rename ApplicationServices.is_interested -> is_interested_in_event 2021-12-08 18:30:52 +00:00
Andrew Morgan bf40bfe37f wip 2021-12-08 18:30:51 +00:00
Andrew Morgan 3edcf4430f Add docstring to add_device_change_to_streams and fix types. 2021-12-08 18:28:59 +00:00
Andrew Morgan 2d514a695e possible perf boost to calculating device list update recipients 2021-12-08 18:28:59 +00:00
Andrew Morgan 3090000857 Add an experimental config option for sending device lists to AS's 2021-12-08 18:28:59 +00:00
Andrew Morgan ba9143817f Fix calls to create_appservice_txn in tests 2021-12-07 10:45:30 +00:00
Andrew Morgan c0b157dc9b Merge branch 'develop' of github.com:matrix-org/synapse into anoa/e2e_as_to_device 2021-12-07 10:36:37 +00:00
reivilibre 2f053f3f82 Stabilise support for MSC2918 refresh tokens as they have now been merged into the Matrix specification. (#11435) 2021-12-06 19:11:43 +00:00
Quentin Gliech a15a893df8 Save the OIDC session ID (sid) with the device on login (#11482)
As a step towards allowing back-channel logout for OIDC.
2021-12-06 12:43:06 -05:00
Dirk Klimpel 8b4b153c9e Add admin API to get some information about federation status (#11407) 2021-12-06 16:59:50 +00:00
Patrick Cloke 494ebd7347 Include bundled aggregations in /sync and related fixes (#11478)
Due to updates to MSC2675 this includes a few fixes:

* Include bundled aggregations for /sync.
* Do not include bundled aggregations for /initialSync and /events.
* Do not bundle aggregations for state events.
* Clarifies comments and variable names.
2021-12-06 15:51:15 +00:00
Sean Quah a77c369897 Move glob_to_regex and re_word_boundary to matrix-python-common (#11505) 2021-12-06 11:36:08 +00:00
Eric Eastwood 4eb77965cd Update backward extremity docs to make it clear that it does not indicate whether we have fetched an events' prev_events (#11469)
Spawning from https://github.com/matrix-org/synapse/pull/9445#discussion_r758958181

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2021-12-03 18:25:04 -06:00
Andrew Morgan 385b3bf056 Modify tests to handle new location of to-device messages in AS txns 2021-12-03 20:03:09 +00:00
Andrew Morgan 403490de8b Insert to-device messages into the new to-device part of AS txns 2021-12-03 20:03:09 +00:00
Andrew Morgan 275e1e0b3a Add to-device messages as their own special section in AS txns 2021-12-03 20:03:09 +00:00
Andrew Morgan 13b25cf51e Fix tests to mock _TransactionController.send of ApplicationServiceScheduler.enqueue*
With enqueue_for_appservice being called per-event per-appservice, it's
not a great target for mocking. So we use _TransactionController.send
instead, to track things that are actually sent out to AS's.

This also has the benefit of testing a wider bit of the AS txn pipeline
2021-12-03 20:03:09 +00:00
Andrew Morgan 6d68b8a4e8 Refactor and generalise the sending of arbitrary fields over AS transactions
Things were starting to get a little inflexible as we kept adding new
types of data to send to application services. It's better to just
have one method for adding data to AS transactions, than one for
each type of data.

Note that subsequent PRs will need to add device lists, one-time keys
and fallback keys to these transactions. Adding those are additional
arguments to a method is much nicer than a new method for each one.

Plus with this setup we can add multiple different types of data at
once without kicking off an AS transaction for each type. This will
be useful for OTK/fallback keys, as we plan to lazily attach those
when handling other event types.
2021-12-03 20:03:09 +00:00
reivilibre 637df95de6 Support configuring the lifetime of non-refreshable access tokens separately to refreshable access tokens. (#11445) 2021-12-03 16:42:44 +00:00
Dirk Klimpel e5f426cd54 Add type hints to synapse/tests/rest/admin (#11501) 2021-12-03 13:57:13 +00:00
Olivier Wilkinson (reivilibre) 8cd68b8102 Revert accidental commits to develop. 2021-12-03 12:31:28 +00:00
Olivier Wilkinson (reivilibre) 6cae125e20 Newsfile
Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
2021-12-03 12:25:37 +00:00
Olivier Wilkinson (reivilibre) 7be88fbf48 Give tests.server.setup_test_homeserver (nominally!) the same behaviour
by calling into `make_test_homeserver_synchronous`.

The function *could* have been inlined at this point but the function is big enough

and it felt fine to leave it as is.

At least there isn't a confusing name clash anymore!
2021-12-03 11:40:05 +00:00
Olivier Wilkinson (reivilibre) b3fd99b74a Move tests.utils.setup_test_homeserver to tests.server
It had no users.

We have just taken the identity of a previous function but don't provide the same
behaviour, so we need to fix this in the next commit...
2021-12-03 11:38:14 +00:00
Olivier Wilkinson (reivilibre) f7ec6e7d9e Convert one of the setup_test_homeservers to make_test_homeserver_synchronous
and pass in the homeserver rather than calling a same-named function to ask for one.

Later commits will jiggle things around to make this sensible.
2021-12-03 11:35:24 +00:00
Richard van der Hoff 5640992d17 Disambiguate queries on state_key (#11497)
We're going to add a `state_key` column to the `events` table, so we need to
add some disambiguation to queries which use it.
2021-12-02 22:42:58 +00:00
David Robertson d26808dd85 Comments on the /sync tentacles (#11494)
This mainly consists of docstrings and inline comments. There are one or two type annotations and variable renames thrown in while I was here.

Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2021-12-02 20:58:32 +00:00
reivilibre f91624a595 Clean up tests.storage.test_appservice (#11492) 2021-12-02 18:43:33 +00:00