Mathieu Velten
75f9e56c77
Merge remote-tracking branch 'origin/develop' into anoa/public_rooms_module_api
2023-05-19 17:35:54 +02:00
Mathieu Velten
2362ef10a3
Fix stuffs
2023-05-19 16:56:26 +02:00
Mathieu Velten
79923666c5
Various fixups
2023-05-19 11:23:55 +02:00
Patrick Cloke
375b0a8a11
Update code to refer to "workers". ( #15606 )
...
A bunch of comments and variables are out of date and use
obsolete terms.
2023-05-16 15:56:38 -04:00
Mathieu Velten
738b372379
Merge remote-tracking branch 'origin/develop' into anoa/public_rooms_module_api
2023-05-16 17:41:39 +02:00
Shay
ba572647b2
Export `run_as_background_process` from the module API ( #15577 )
2023-05-15 13:11:21 -07:00
Andrew Morgan
2e59e97ebd
Move ThirdPartyEventRules into module_api/callbacks ( #15535 )
2023-05-04 14:18:22 +00:00
Andrew Morgan
2436153e8f
Add a new public rooms callback class, a new fetch_public_rooms callback
...
fetch_public_rooms is a module API callback intended to be used when a
request for the homeserver's public rooms list comes in via either the
CS or SS API. Modules can return an ordered array of public rooms that
they would like to inject into the list supplied by the homeserver.
This can be useful for exposing known rooms that users on the
homeserver have not joined yet, and the property of mixing with the
normal public rooms list is desirable versus the solution of creating
a new third-party network type to load your rooms under.
2023-05-02 15:23:32 +01:00
Mathieu Velten
247e6a8a78
Add a module API to send an HTTP push notification ( #15387 )
...
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2023-04-26 21:10:51 +02:00
Andrew Morgan
aec639e3e3
Move Spam Checker callbacks to a dedicated file ( #15453 )
2023-04-18 00:57:40 +00:00
Andrew Morgan
4953cd71df
Move Account Validity callbacks to a dedicated file ( #15237 )
2023-03-16 10:35:31 +00:00
Andrew Morgan
b40657314e
Add module API callbacks for adding and deleting local 3PID associations ( #15044
2023-02-27 14:19:19 +00:00
David Robertson
647ff3ef65
Remove unused `room_alias` field from `/createRoom` response ( #15093 )
...
* Change `create_room` return type
* Don't return room alias from /createRoom
* Update other callsites
* Fix up mypy complaints
It looks like new_room_user_id is None iff new_room_id is None. It's a
shame we haven't expressed this in a way that mypy can understand.
* Changelog
2023-02-22 11:07:28 +00:00
Patrick Cloke
7e8d455280
Fix a bug in the send_local_online_presence_to module API ( #14880 )
...
Destination was being used incorrectly (a single destination instead
of a list of destinations was being passed).
This also updates some of the types in the area to not use Collection[str],
which is a footgun.
2023-01-25 21:34:37 +00:00
Emelie Graven
dd9e71dc7f
Add `set_displayname` to the module API ( #14629 )
2023-01-11 18:41:52 +00:00
Brendan Abolivier
3854d0f949
Add a `cached` helper to the module API ( #14663 )
2022-12-28 13:48:21 +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
Patrick Cloke
6d47b7e325
Add a type hint for `get_device_handler()` and fix incorrect types. ( #14055 )
...
This was the last untyped handler from the HomeServer object. Since
it was being treated as Any (and thus unchecked) it was being used
incorrectly in a few places.
2022-11-22 14:08:04 -05:00
Patrick Cloke
d8cc86eff4
Remove redundant types from comments. ( #14412 )
...
Remove type hints from comments which have been added
as Python type hints. This helps avoid drift between comments
and reality, as well as removing redundant information.
Also adds some missing type hints which were simple to fill in.
2022-11-16 15:25:24 +00:00
Quentin Gliech
8756d5c87e
Save login tokens in database ( #13844 )
...
* Save login tokens in database
Signed-off-by: Quentin Gliech <quenting@element.io>
* Add upgrade notes
* Track login token reuse in a Prometheus metric
Signed-off-by: Quentin Gliech <quenting@element.io>
2022-10-26 11:45:41 +01:00
Quentin Gliech
79c592cec6
Deprecate the `generate_short_term_login_token` method in favor of an async `create_login_token` method in the Module API. ( #13842 )
...
Signed-off-by: Quentin Gliech <quenting@element.io>
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-10-06 10:22:36 +00:00
Brendan Abolivier
1cc2ca81ba
Add missing version information in the ModuleApi ( #13947 )
2022-09-30 12:27:21 +02:00
Mathieu Velten
6bd8763804
Add cache invalidation across workers to module API ( #13667 )
...
Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
2022-09-21 15:32:01 +02:00
Quentin Gliech
85fc7ea1a1
Remove the `complete_sso_login` method from the Module API which was deprecated in Synapse 1.13.0. ( #13843 )
...
Signed-off-by: Quentin Gliech <quenting@element.io>
2022-09-20 15:18:07 +02:00
Matt C
026ac4486c
Update module API "update room membership" method to allow for remote joins ( #13441 )
...
Co-authored-by: MattC <buffless-matt@users.noreply.github.com>
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-08-05 09:37:58 +00:00
Matt C
a91078200d
Add module API method to create a room ( #13429 )
...
Co-authored-by: MattC <buffless-matt@users.noreply.github.com>
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-08-04 09:34:05 +00:00
Matt C
570bf32bbb
Add module API method to resolve a room alias to a room ID ( #13428 )
...
Co-authored-by: MattC <buffless-matt@users.noreply.github.com>
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-08-03 09:25:36 +00:00
David Teller
11f811470f
Uniformize spam-checker API, part 5: expand other spam-checker callbacks to return `Tuple[Codes, dict]` ( #13044 )
...
Signed-off-by: David Teller <davidt@element.io>
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-07-11 16:52:10 +00:00
David Teller
a164a46038
Uniformize spam-checker API, part 4: port other spam-checker callbacks to return `Union[Allow, Codes]`. ( #12857 )
...
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-06-13 18:16:16 +00:00
Patrick Cloke
9dc3293e0b
Consolidate the logic of delete_device/delete_devices. ( #12970 )
...
By always using delete_devices and sometimes passing a list
with a single device ID.
Previously these methods had gotten out of sync with each
other and it seems there's little benefit to the single-device
variant.
2022-06-07 07:43:35 -04:00
Erik Johnston
888a29f412
Wait for lazy join to complete when getting current state ( #12872 )
2022-06-01 16:02:53 +01:00
Erik Johnston
3594f6c1f3
Merge branch 'master' into develop
2022-05-31 14:48:22 +01:00
Brendan Abolivier
8fd87739bf
Fix import in module_api module and docs on the new check_event_for_spam signature ( #12918 )
...
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-05-31 12:04:53 +02:00
Brendan Abolivier
cd9fc058de
Document the Synapse version of a new module API method ( #12917 )
2022-05-30 18:37:52 +02:00
Matt C
a7da00d4f7
Add storage and module API methods to get monthly active users and their appservices ( #12838 )
2022-05-27 10:25:57 +00:00
David Teller
28199e9357
Uniformize spam-checker API, part 2: check_event_for_spam ( #12808 )
...
Signed-off-by: David Teller <davidt@element.io>
2022-05-23 17:27:39 +00:00
Jess Porter
a608ac847b
add SpamChecker callback for silently dropping inbound federated events ( #12744 )
...
Signed-off-by: jesopo <github@lolnerd.net>
2022-05-23 16:36:21 +00:00
David Robertson
fa0eab9c8e
Use `ParamSpec` in a few places ( #12667 )
2022-05-09 10:27:39 +00:00
Brendan Abolivier
5ef673de4f
Add a module API to allow modules to edit push rule actions ( #12406 )
...
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-04-27 13:55:33 +00:00
David Robertson
6463244375
Remove unused `# type: ignore`s ( #12531 )
...
Over time we've begun to use newer versions of mypy, typeshed, stub
packages---and of course we've improved our own annotations. This makes
some type ignore comments no longer necessary. I have removed them.
There was one exception: a module that imports `select.epoll`. The
ignore is redundant on Linux, but I've kept it ignored for those of us
who work on the source tree using not-Linux. (#11771 )
I'm more interested in the config line which enforces this. I want
unused ignores to be reported, because I think it's useful feedback when
annotating to know when you've fixed a problem you had to previously
ignore.
* Installing extras before typechecking
Lacking an easy way to install all extras generically, let's bite the bullet and
make install the hand-maintained `all` extra before typechecking.
Now that https://github.com/matrix-org/backend-meta/pull/6 is merged to
the release/v1 branch.
2022-04-27 14:03:44 +01:00
reivilibre
85ca963c1a
Add Module API for reading and writing global account data. ( #12391 )
2022-04-11 10:05:43 +01:00
Brendan Abolivier
e4409301ba
Add a module callback to react to account data changes ( #12327 )
...
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2022-04-01 11:22:48 +02:00
Amanda Graven
4e900ece42
Add set_user_admin function to the module API ( #12341 )
2022-04-01 09:31:30 +01:00
Brendan Abolivier
5e88143dff
Add a callback to react to 3PID associations ( #12302 )
2022-03-31 18:27:21 +02:00
Brendan Abolivier
8cd760fca8
Allow modules to store already existing 3PID associations ( #12195 )
2022-03-28 18:57:19 +02:00
Nicolas Werner
692b82838e
Allow registering admin users using the module API ( #12250 )
...
Signed-off-by: Nicolas Werner <n.werner@famedly.com>
2022-03-23 12:48:47 +01:00
David Robertson
872dbb0181
Correct `check_username_for_spam` annotations and docs ( #12246 )
...
* Formally type the UserProfile in user searches
* export UserProfile in synapse.module_api
* Update docs
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
2022-03-18 13:51:41 +00:00
Will Hunt
15382b1afa
Add third_party module callbacks to check if a user can delete a room and deactivate a user ( #12028 )
...
* Add check_can_deactivate_user
* Add check_can_shutdown_rooms
* Documentation
* callbacks, not functions
* Various suggested tweaks
* Add tests for test_check_can_shutdown_room and test_check_can_deactivate_user
* Update check_can_deactivate_user to not take a Requester
* Fix check_can_shutdown_room docs
* Renegade and use `by_admin` instead of `admin_user_id`
* fix lint
* Update docs/modules/third_party_rules_callbacks.md
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Update docs/modules/third_party_rules_callbacks.md
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Update docs/modules/third_party_rules_callbacks.md
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Update docs/modules/third_party_rules_callbacks.md
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-03-09 18:23:57 +00:00
Brendan Abolivier
ae8a616b49
Correctly register deactivation and profile update module callbacks ( #12141 )
2022-03-03 11:39:58 +01:00
Brendan Abolivier
300ed0b8a6
Add module callbacks called for reacting to deactivation status change and profile update ( #12062 )
2022-03-01 15:00:03 +00:00