summary refs log tree commit diff
path: root/synapse/handlers/relations.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Bump black from 23.10.1 to 24.2.0 (#16936)dependabot[bot]2024-03-131-7/+7
|
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-231-0/+1
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* Add recursion_depth to /relations if recursing (#16775)David Baker2024-01-041-0/+4
| | | | | This is an extra response parameter just added to MSC3981. In the current impl, the recursion depth is always 3, so this just returns a static 3 if the recurse parameter is supplied.
* Update license headersPatrick Cloke2023-11-211-10/+16
|
* Add new module API for adding custom fields to events `unsigned` section ↵Erik Johnston2023-10-271-3/+5
| | | | (#16549)
* Convert more cached return values to immutable types (#16356)Patrick Cloke2023-09-201-2/+12
|
* Add a catch-all * to the supported relation types when redacting (#15705)Mathieu Velten2023-06-021-5/+11
| | | This is an update to MSC3912 implementation
* Initial implementation of MSC3981: recursive relations API (#15315)Patrick Cloke2023-05-021-0/+3
| | | | | | | | | | | Adds an optional keyword argument to the /relations API which will recurse a limited number of event relationships. This will cause the API to return not just the events related to the parent event, but also events related to those related to the parent event, etc. This is disabled by default behind an experimental configuration flag and is currently implemented using prefixed parameters.
* Pass the requester during event serialization. (#15174)Quentin Gliech2023-03-061-2/+10
| | | | This allows Synapse to properly include the transaction ID in the unsigned data of events.
* Remove support for aggregating reactions (#15172)Richard van der Hoff2023-02-281-75/+1
| | | | | | | | | | It turns out that no clients rely on server-side aggregation of `m.annotation` relationships: it's just not very useful as currently implemented. It's also non-trivial to calculate. I want to remove it from MSC2677, so to keep the implementation in line, let's remove it here.
* Use an enum for direction. (#14927)Patrick Cloke2023-01-271-2/+6
| | | | For better type safety we use an enum instead of strings to configure direction (backwards or forwards).
* Parallelize calls to fetch bundled aggregations. (#14510)Patrick Cloke2022-11-221-32/+51
| | | | The bundled aggregations for annotations, references, and edits can be parallelized.
* Batch fetch bundled references (#14508)Patrick Cloke2022-11-221-69/+59
| | | | | | | | | Avoid an n+1 query problem and fetch the bundled aggregations for m.reference relations in a single query instead of a query per event. This applies similar logic for as was previously done for edits in 8b309adb436c162510ed1402f33b8741d71fc058 (#11660; threads in b65acead428653b988351ae8d7b22127a22039cd (#11752); and annotations in 1799a54a545618782840a60950ef4b64da9ee24d (#14491).
* Batch fetch bundled annotations (#14491)Patrick Cloke2022-11-221-84/+113
| | | | | | | | Avoid an n+1 query problem and fetch the bundled aggregations for m.annotation relations in a single query instead of a query per event. This applies similar logic for as was previously done for edits in 8b309adb436c162510ed1402f33b8741d71fc058 (#11660) and threads in b65acead428653b988351ae8d7b22127a22039cd (#11752).
* Implement MSC3912: Relation-based redactions (#14260)Brendan Abolivier2022-11-031-1/+55
| | | Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Do not allow a None-limit on PaginationConfig. (#14146)Patrick Cloke2022-10-141-3/+0
| | | | | | | The callers either set a default limit or manually handle a None-limit later on (by setting a default value). Update the callers to always instantiate PaginationConfig with a default limit and then assume the limit is non-None.
* Add an API for listing threads in a room. (#13394)Patrick Cloke2022-10-131-1/+85
| | | | | | | | | Implement the /threads endpoint from MSC3856. This is currently unstable and behind an experimental configuration flag. It includes a background update to backfill data, results from the /threads endpoint will be partial until that finishes.
* Remove support for the unstable dir flag on relations. (#14106)Patrick Cloke2022-10-071-17/+16
| | | | | | From MSC3715, this was unused by clients (and there was no way for clients to know it was supported). Matrix 1.4 defines the stable field.
* Do not return unspecced original_event field when using the stable ↵Patrick Cloke2022-10-031-12/+13
| | | | | | | | | | /relations endpoint. (#14025) Keep the old behavior (of including the original_event field) for any requests to the /unstable version of the endpoint, but do not include the field when the /v1 version is used. This should avoid new clients from depending on this field, but will not help with current dependencies.
* `synapse.api.auth.Auth` cleanup: make permission-related methods use ↵Quentin Gliech2022-08-221-1/+1
| | | | | | | | | `Requester` instead of the `UserID` (#13024) Part of #13019 This changes all the permission-related methods to rely on the Requester instead of the UserID. This is a first step towards enabling scoped access tokens at some point, since I expect the Requester to have scope-related informations in it. It also changes methods which figure out the user/device/appservice out of the access token to return a Requester instead of something else. This avoids having store-related objects in the methods signatures.
* Instrument `/messages` for understandable traces in Jaeger (#13368)Eric Eastwood2022-08-031-0/+2
| | | | | | In Jaeger: - Before: huge list of uncategorized database calls - After: nice and collapsible into units of work
* Remove unused argument for get_relations_for_event. (#13383)Patrick Cloke2022-07-261-3/+0
|
* Implement MSC3816, consider the root event for thread participation. (#12766)Patrick Cloke2022-06-061-21/+37
| | | | As opposed to only considering a user to have "participated" if they replied to the thread.
* Rename storage classes (#12913)Erik Johnston2022-05-311-2/+5
|
* Consolidate logic for parsing relations. (#12693)Patrick Cloke2022-05-161-10/+10
| | | | | | | | | | | | | Parse the `m.relates_to` event content field (which describes relations) in a single place, this is used during: * Event persistence. * Validation of the Client-Server API. * Fetching bundled aggregations. * Processing of push rules. Each of these separately implement the logic and each made slightly different assumptions about what was valid. Some had minor / potential bugs.
* Edits/annotations should not have any bundled aggregations calculated. (#12633)Patrick Cloke2022-05-051-20/+18
| | | | | | Fixes a regression from 8b309adb436c162510ed1402f33b8741d71fc058 (#11660) and b65acead428653b988351ae8d7b22127a22039cd (#11752) where events which themselves were an edit or an annotation could have bundled aggregations calculated, which is not allowed.
* Include bundled aggregations for the latest event in a thread. (#12273)Patrick Cloke2022-05-041-20/+54
| | | | | | The `latest_event` field of the bundled aggregations for `m.thread` relations did not include bundled aggregations itself. This resulted in clients needing to immediately request the event from the server (and thus making it useless that the latest event itself was serialized instead of just including an event ID).
* Consistently use collections.abc.Mapping to check frozendict. (#12564)Patrick Cloke2022-04-271-2/+2
|
* Misc. clean-ups to the relations code (#12519)Patrick Cloke2022-04-251-62/+32
| | | | | * Corrects some typos / copy & paste errors in tests. * Clarifies docstrings. * Removes an unnecessary method.
* Do not consider events by ignored users for bundled aggregations (#12235)Patrick Cloke2022-04-111-30/+214
| | | | | | | Consider the requester's ignored users when calculating the bundled aggregations. See #12285 / 4df10d32148ae29f792afc68ff774bcbd1915cea for corresponding changes for the `/relations` endpoint.
* Remove an unnecessary class from the relations code. (#12338)Patrick Cloke2022-03-311-12/+23
| | | | | The PaginationChunk class attempted to bundle some properties together, but really just caused callers to jump through hoops and hid implementation details.
* Remove the unused and unstable `/aggregations` endpoint. (#12293)Patrick Cloke2022-03-301-4/+2
| | | | | | | | | This endpoint was removed from MSC2675 before it was approved. It is currently unspecified (even in any MSCs) and therefore subject to removal. It is not implemented by any known clients. This also changes the bundled aggregation format for `m.annotation`, which previously included pagination tokens for the `/aggregations` endpoint, which are no longer useful.
* Do not consider events by ignored users for relations (#12285)Patrick Cloke2022-03-241-1/+8
| | | | Filter the events returned from `/relations` for the requester's ignored users in a similar way to `/messages` (and `/sync`).
* Move get_bundled_aggregations to relations handler. (#12237)Patrick Cloke2022-03-181-2/+149
| | | | | The get_bundled_aggregations code is fairly high-level and uses a lot of store methods, we move it into the handler as that seems like a better fit.
* Add a relations handler to avoid duplication. (#12227)Patrick Cloke2022-03-161-0/+117
Adds a handler layer between the REST and datastore layers for relations.