summary refs log tree commit diff
path: root/synapse/storage/databases/main/relations.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused argument for get_relations_for_event. (#13383)Patrick Cloke2022-07-261-6/+0
|
* Fix caching behavior for relations push rules. (#12859)Patrick Cloke2022-05-251-2/+3
| | | | | By always returning all requested values from the function wrapped by cachedList. Otherwise implicit None values get added into the cache, which are unexpected.
* Experimental support for MSC3772 (#12740)Patrick Cloke2022-05-241-0/+52
| | | | | | | | | | Implements the following behind an experimental configuration flag: * A new push rule kind for mutually related events. * A new default push rule (`.m.rule.thread_reply`) under an unstable prefix. This is missing part of MSC3772: * The `.m.rule.thread_reply_to_me` push rule, this depends on MSC3664 / #11804.
* Add `StreamKeyType` class and replace string literals with constants (#12567)Andrew Morgan2022-05-161-2/+4
|
* Include bundled aggregations for the latest event in a thread. (#12273)Patrick Cloke2022-05-041-8/+3
| | | | | | 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).
* Remove references to unstable identifiers from MSC3440. (#12382)Patrick Cloke2022-04-121-62/+16
| | | | | Removes references to unstable thread relation, unstable identifiers for filtering parameters, and the experimental config flag.
* Add some type hints to datastore (#12423)Dirk Klimpel2022-04-121-1/+1
| | | | | | | | | | | | | | | | | | | * Add some type hints to datastore * newsfile * change `Collection` to `List` * refactor return type of `select_users_txn` * correct type hint in `stream.py` * Remove `Optional` in `select_users_txn` * remove not needed return type in `__init__` * Revert change in `get_stream_id_for_event_txn` * Remove import from `Literal`
* Do not consider events by ignored users for bundled aggregations (#12235)Patrick Cloke2022-04-111-9/+143
| | | | | | | 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-9/+8
| | | | | 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-65/+13
| | | | | | | | | 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.
* Move get_bundled_aggregations to relations handler. (#12237)Patrick Cloke2022-03-181-146/+5
| | | | | 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.
* Only fetch thread participation for events with threads. (#12228)Patrick Cloke2022-03-181-1/+3
| | | | | | | | | We fetch the thread summary in two phases: 1. The summary that is shared by all users (count of messages and latest event). 2. Whether the requesting user has participated in the thread. There's no use in attempting step 2 for events which did not return a summary from step 1.
* Support stable identifiers for MSC3440: Threading (#12151)Patrick Cloke2022-03-101-30/+47
| | | | The unstable identifiers are still supported if the experimental configuration flag is enabled. The unstable identifiers will be removed in a future release.
* Allow retrieving the relations of a redacted event. (#12130)Patrick Cloke2022-03-101-28/+32
| | | | | | | | | This is allowed per MSC2675, although the original implementation did not allow for it and would return an empty chunk / not bundle aggregations. The main thing to improve is that the various caches get cleared properly when an event is redacted, and that edits must not leak if the original event is redacted (as that would presumably leak something similar to the original event content).
* Fix a typo in a comment.Patrick Cloke2022-02-161-1/+1
|
* Fix incorrect thread summaries when the latest event is edited. (#11992)Patrick Cloke2022-02-151-6/+18
| | | | | If the latest event in a thread was edited than the original event content was included in bundled aggregation for threads instead of the edited event content.
* Fetch thread summaries for multiple events in a single query (#11752)Patrick Cloke2022-02-111-73/+149
| | | | | This should reduce database usage when fetching bundled aggregations as the number of individual queries (and round trips to the database) are reduced.
* Support pagination tokens from /sync and /messages in the relations API. ↵Patrick Cloke2022-02-101-15/+31
| | | | (#11952)
* Experimental support to include bundled aggregations in search results ↵Patrick Cloke2022-02-081-2/+11
| | | | (MSC3666) (#11837)
* Fetch edits for multiple events in a single query. (#11660)Patrick Cloke2022-02-081-51/+99
| | | | | This should reduce database usage when fetching bundled aggregations as the number of individual queries (and round trips to the database) are reduced.
* Remove the obsolete MSC1849 configuration flag. (#11843)Patrick Cloke2022-01-311-4/+0
| | | | | MSC1849 was replaced by MSC2675, which was merged. The configuration flag, which defaulted to true, is no longer useful.
* Improvements to bundling aggregations. (#11815)Patrick Cloke2022-01-261-23/+38
| | | | | | | | | | | This is some odds and ends found during the review of #11791 and while continuing to work in this code: * Return attrs classes instead of dictionaries from some methods to improve type safety. * Call `get_bundled_aggregations` fewer times. * Adds a missing assertion in the tests. * Do not return empty bundled aggregations for an event (preferring to not include the bundle at all, as the docstring states).
* Include whether the requesting user has participated in a thread. (#11577)Patrick Cloke2022-01-181-11/+55
| | | | | | Per updates to MSC3440. This is implement as a separate method since it needs to be cached on a per-user basis, instead of a per-thread basis.
* Bundle aggregations outside of the serialization method. (#11612)Patrick Cloke2022-01-071-3/+125
| | | | | | | | This makes the serialization of events synchronous (and it no longer access the database), but we must manually calculate and provide the bundled aggregations. Overall this should cause no change in behavior, but is prep work for other improvements.
* Improve type hints in storage classes. (#11652)Dirk Klimpel2021-12-291-2/+2
| | | By using cast and making ignores more specific.
* Remove redundant `COALESCE()`s around `COUNT()`s in database queries (#11570)Sean Quah2021-12-141-1/+1
| | | | | `COUNT()` never returns `NULL`. A `COUNT(*)` over 0 rows is 0 and a `COUNT(NULL)` is also 0.
* Do not allow cross-room relations, per MSC2674. (#11516)Patrick Cloke2021-12-091-10/+26
|
* Do not allow MSC3440 threads to fork threads (#11161)Patrick Cloke2021-11-181-2/+65
| | | | | | | | | | | Adds validation to the Client-Server API to ensure that the potential thread head does not relate to another event already. This results in not allowing a thread to "fork" into other threads. If the target event is unknown for some reason (maybe it isn't visible to your homeserver), but is the target of other events it is assumed that the thread can be created from it. Otherwise, it is rejected as an unknown event.
* Support filtering by relations per MSC3440 (#11236)Patrick Cloke2021-11-091-1/+57
| | | | Adds experimental support for `relation_types` and `relation_senders` fields for filters.
* Additional type hints for relations database class. (#11205)Patrick Cloke2021-10-281-15/+23
|
* Add a thread relation type per MSC3440. (#11088)Patrick Cloke2021-10-211-1/+58
| | | | Adds experimental support for MSC3440's `io.element.thread` relation type (and the aggregation for it).
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | 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>`
* Convert additional databases to async/await (#8199)Patrick Cloke2020-09-011-55/+48
|
* Convert appservice, group server, profile and more databases to async (#8066)Patrick Cloke2020-08-121-9/+10
|
* Rename database classes to make some sense (#8033)Erik Johnston2020-08-051-0/+327