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.
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.
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.
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
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.
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!
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...
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>