summary refs log tree commit diff
path: root/synapse/handlers/receipts.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Return read-only collections from `@cached` methods (#13755)Sean Quah2023-02-101-2/+2
| | | | | | | | | | | | | It's important that collections returned from `@cached` methods are not modified, otherwise future retrievals from the cache will return the modified collection. This applies to the return values from `@cached` methods and the values inside the dictionaries returned by `@cachedList` methods. It's not necessary for the dictionaries returned by `@cachedList` methods themselves to be read-only. Signed-off-by: Sean Quah <seanq@matrix.org> Co-authored-by: David Robertson <davidr@element.io>
* Add helper to parse an enum from query args & use it. (#14956)Patrick Cloke2023-02-011-1/+1
| | | | | | | | The `parse_enum` helper pulls an enum value from the query string (by delegating down to the parse_string helper with values generated from the enum). This is used to pull out "f" and "b" in most places and then we thread the resulting Direction enum throughout more code.
* Include thread information when sending receipts over federation. (#14466)Patrick Cloke2022-11-281-1/+0
| | | | | | | | | | | | Include the thread_id field when sending read receipts over federation. This might result in the same user having multiple read receipts per-room, meaning multiple EDUs must be sent to encapsulate those receipts. This restructures the PerDestinationQueue APIs to support multiple receipt EDUs, queue_read_receipt now becomes linear time in the number of queued threaded receipts in the room for the given user, it is expected this is a small number since receipt EDUs are sent as filler in transactions.
* Do not allow a None-limit on PaginationConfig. (#14146)Patrick Cloke2022-10-141-1/+1
| | | | | | | 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.
* Use stable identifiers for MSC3771 & MSC3773. (#14050)Patrick Cloke2022-10-071-7/+4
| | | | | These are both part of Matrix 1.4 which has now been released. For now, support both the unstable and stable identifiers.
* Accept & store thread IDs for receipts (implement MSC3771). (#13782)Patrick Cloke2022-09-231-2/+21
| | | | Updates the `/receipts` endpoint and receipt EDU handler to parse a `thread_id` from the body and insert it in the database.
* Faster Remote Room Joins: tell remote homeservers that we are unable to ↵reivilibre2022-09-231-1/+1
| | | | authorise them if they query a room which has partial state on our server. (#13823)
* Remove support for unstable private read receipts (#13653)Šimon Brandner2022-09-011-23/+6
| | | Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Support stable identifiers for MSC2285: private read receipts. (#13273)Šimon Brandner2022-08-051-10/+26
| | | | | This adds support for the stable identifiers of MSC2285 while continuing to support the unstable identifiers behind the configuration flag. These will be removed in a future version.
* Additional constants for EDU types. (#12884)Patrick Cloke2022-05-271-3/+3
| | | Instead of hard-coding strings in many places.
* Add `StreamKeyType` class and replace string literals with constants (#12567)Andrew Morgan2022-05-161-2/+10
|
* Avoid unnecessary copies when filtering private read receipts. (#12711)Šimon Brandner2022-05-161-33/+61
| | | | | | A minor optimization to avoid unnecessary copying/building identical dictionaries when filtering private read receipts. Also clarifies comments and cleans-up some tests.
* Use `private` instead of `hidden` in MSC2285 related code. (#12635)Šimon Brandner2022-05-051-3/+3
|
* Implement changes to MSC2285 (hidden read receipts) (#12168)Šimon Brandner2022-05-041-38/+27
| | | | | * Changes hidden read receipts to be a separate receipt type (instead of a field on `m.read`). * Updates the `/receipts` endpoint to accept `m.fully_read`.
* Bound ephemeral events by key (#12544)Nick Mills-Barrett2022-04-261-2/+2
| | | | Co-authored-by: Brad Murray <bradtgmurray@gmail.com> Co-authored-by: Andrew Morgan <andrewm@element.io>
* Rename various ApplicationServices interested methods (#11915)Andrew Morgan2022-03-031-1/+1
|
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-2/+2
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Add a constant for receipt types (m.read). (#11531)Patrick Cloke2021-12-081-3/+3
| | | And expand some type hints in the receipts storage module.
* Improve docstrings for methods related to sending EDUs to application ↵Andrew Morgan2021-10-211-1/+7
| | | | services (#11138)
* Remove the deprecated BaseHandler. (#11005)Patrick Cloke2021-10-081-4/+2
| | | | | | | | The shared ratelimit function was replaced with a dedicated RequestRatelimiter class (accessible from the HomeServer object). Other properties were copied to each sub-class that inherited from BaseHandler.
* Remove unnecessary parentheses around tuples returned from methods (#10889)Andrew Morgan2021-09-231-2/+2
|
* Add type hints for event streams. (#10856)Patrick Cloke2021-09-211-3/+10
|
* Require type hints in the handlers module. (#10831)Patrick Cloke2021-09-201-2/+2
| | | | | | | Adds missing type hints to methods in the synapse.handlers module and requires all methods to have type hints there. This also removes the unused construct_auth_difference method from the FederationHandler.
* Use direct references for some configuration variables (#10798)Patrick Cloke2021-09-131-1/+1
| | | | Instead of proxying through the magic getter of the RootConfig object. This should be more performant (and is more explicit).
* Handle string read receipt data (#10606)Šimon Brandner2021-08-161-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Handle string read receipt data Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Test that we handle string read receipt data Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Add changelog for #10606 Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Add docs Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Ignore malformed RRs Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Only surround hidden = ... Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Remove unnecessary argument Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Update changelog.d/10606.bugfix Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Include room ID in ignored EDU log messages (#10507)Dagfinn Ilmari Mannsåker2021-08-031-1/+2
| | | | Signed-off-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
* Support for MSC2285 (hidden read receipts) (#10413)Šimon Brandner2021-07-281-5/+53
| | | Implementation of matrix-org/matrix-doc#2285
* Use inline type hints in `handlers/` and `rest/`. (#10382)Jonathan de Jong2021-07-161-2/+2
|
* Ignore EDUs for rooms we're not in (#10317)Dagfinn Ilmari Mannsåker2021-07-061-0/+15
|
* 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>`
* Import HomeServer from the proper module. (#9665)Patrick Cloke2021-03-231-1/+1
|
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-5/+4
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Allow moving account data and receipts streams off master (#9104)Erik Johnston2021-01-181-5/+22
|
* Add type hints to the receipts and user directory handlers. (#8976)Patrick Cloke2021-01-041-11/+19
|
* Allow spam-checker modules to be provide async methods. (#8890)David Teller2020-12-111-5/+2
| | | | Spam checker modules can now provide async methods. This is implemented in a backwards-compatible manner.
* Improve appservice handler to send only the most recent read receipts when ↵Will Hunt2020-11-181-1/+2
| | | | | | | | | | | | | | | | | | | no stream_id is stored. (#8744) * Make this line debug (it's noisy) * Don't include from_key for presence if we are at 0 * Limit read receipts for all rooms to 100 * changelog.d/8744.bugfix * Allow from_key to be None * Update 8744.bugfix * The from_key is superflous * Update comment
* Send some ephemeral events to appservices (#8437)Will Hunt2020-10-151-1/+34
| | | Optionally sends typing, presence, and read receipt information to appservices.
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-181-1/+1
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Clean up types for PaginationConfig (#8250)Erik Johnston2020-09-081-15/+0
| | | This removes `SourcePaginationConfig` and `get_pagination_rows`. The reasoning behind this is that these generic classes/functions erased the types of the IDs it used (i.e. instead of passing around `StreamToken` it'd pass in e.g. `token.room_key`, which don't have uniform types).
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Convert _base, profile, and _receipts handlers to async/await (#7860)Patrick Cloke2020-07-171-10/+6
|
* Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)Patrick Cloke2020-02-211-1/+1
| | | | Ensure good comprehension hygiene using flake8-comprehensions.
* Port receipt and read markers to async/waitErik Johnston2019-10-291-25/+12
|
* Remove unnecessary parentheses around return statements (#5931)Andrew Morgan2019-08-301-1/+1
| | | | | Python will return a tuple whether there are parentheses around the returned values or not. I'm just sick of my editor complaining about this all over the place :)
* Merge pull request #5743 from matrix-org/erikj/log_origin_receipts_mismatchErik Johnston2019-07-241-13/+22
|\ | | | | Log when we receive receipt from a different origin
| * Log when we receive receipt from a different originErik Johnston2019-07-231-13/+22
| |
* | Replace returnValue with return (#5736)Amber Brown2019-07-231-7/+7
|/
* Run Black. (#5482)Amber Brown2019-06-201-18/+8
|
* Batch up outgoing read-receipts to reduce federation traffic. (#4890)Richard van der Hoff2019-03-201-1/+1
| | | | Rate-limit outgoing read-receipts as per #4730.
* Move client receipt processing to federation sender worker.Richard van der Hoff2019-03-131-33/+4
| | | | | This is mostly a prerequisite for #4730, but also fits with the general theme of "move everything off the master that we possibly can".
* declare a ReadReceipt classRichard van der Hoff2019-03-131-24/+22
| | | | | I'm going to use this in queues and things, so it'll be useful to give it more of a structure.
* Clean up read-receipt handling.Richard van der Hoff2019-03-041-59/+44
| | | | | | | Remove a call to run_as_background_process: there is no need to run this as a background process, because build_and_send_edu does not block. We may as well inline the whole of _push_remotes.
* Avoid rebuilding Edu objects in worker mode (#4770)Richard van der Hoff2019-03-041-1/+1
| | | | | In worker mode, on the federation sender, when we receive an edu for sending over the replication socket, it is parsed into an Edu object. There is no point extracting the contents of it so that we can then immediately build another Edu.
* Run push_receipts_to_remotes as background job (#4707)Richard van der Hoff2019-02-211-34/+34
| | | I suspect the CPU usage metrics for this are going to /dev/null at the moment.
* Remove redundant run_as_background_process() from pusherpoolRichard van der Hoff2018-10-221-1/+1
| | | | | | | `on_new_notifications` and `on_new_receipts` in `HttpPusher` and `EmailPusher` now always return synchronously, so we can remove the `defer.gatherResults` on their results, and the `run_as_background_process` wrappers can be removed too because the PusherPool methods will now complete quickly enough.
* Fix logcontexts for running pushersRichard van der Hoff2018-08-171-10/+8
| | | | | | | First of all, avoid resetting the logcontext before running the pushers, to fix the "Starting db txn 'get_all_updated_receipts' from sentinel context" warning. Instead, give them their own "background process" logcontexts.
* run isortAmber Brown2018-07-091-6/+4
|
* Improve exception handling for background processesRichard van der Hoff2018-04-271-29/+32
| | | | | | | | | | | | | | | | | | There were a bunch of places where we fire off a process to happen in the background, but don't have any exception handling on it - instead relying on the unhandled error being logged when the relevent deferred gets garbage-collected. This is unsatisfactory for a number of reasons: - logging on garbage collection is best-effort and may happen some time after the error, if at all - it can be hard to figure out where the error actually happened. - it is logged as a scary CRITICAL error which (a) I always forget to grep for and (b) it's not really CRITICAL if a background process we don't care about fails. So this is an attempt to add exception handling to everything we fire off into the background.
* Split out edu/query registration to a separate classErik Johnston2018-03-131-1/+1
|
* fix a logcontext leak in read receipt handlingRichard van der Hoff2017-10-111-0/+4
|
* Don't recreate so many setsErik Johnston2017-03-161-3/+2
|
* Fix ignored read-receiptsRichard van der Hoff2016-12-081-1/+5
| | | | | Don't ignore read-receipts which arrive in the same EDU as a read-receipt for an old event.
* Use new federation_sender DIErik Johnston2016-11-161-2/+2
|
* Clobber EDUs in send queueErik Johnston2016-09-091-0/+1
|
* Use state handler instead of get_users_in_room/get_joined_hostsErik Johnston2016-08-261-1/+4
|
* Replaces calls to fetch_room_distributions_into with get_joined_hosts_for_roomMark Haines2016-05-161-6/+5
|
* Add comments on min_stream_idDavid Baker2016-04-071-0/+1
| | | | saying that the min stream id won't be completely accurate all the time
* Send badge count pushes.David Baker2016-04-071-4/+17
| | | | Also fix bugs with retrying.
* Add enviroment variable SYNAPSE_CACHE_FACTOR, default it to 0.1Erik Johnston2016-03-011-2/+0
|
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Open up /events to anonymous users for room events onlyDaniel Wagner-Hall2015-11-051-4/+2
| | | | Squash-merge of PR #345 from daniel/anonymousevents
* Fix receipts for room initial syncErik Johnston2015-10-221-7/+1
|
* Re-enable receiptsErik Johnston2015-08-131-2/+0
|
* Disable receipts for nowMatrix2015-07-221-0/+2
|
* Don't do any database hits in receipt handling if from_key == to_keyMatrix2015-07-181-0/+3
|
* DocsErik Johnston2015-07-141-3/+8
|
* CommentsErik Johnston2015-07-131-4/+12
|
* Remove spurious commentErik Johnston2015-07-091-2/+0
|
* Integer timestampsErik Johnston2015-07-091-1/+1
|
* Change format of receipts to allow inclusion of dataErik Johnston2015-07-091-8/+16
|
* Add a cache to fetching of receipt streamsErik Johnston2015-07-081-24/+7
|
* Split receipt events up into one per roomErik Johnston2015-07-081-30/+21
|
* Hook up receipts to v1 initialSyncErik Johnston2015-07-081-1/+44
|
* Wire together receipts and the notifer/federationErik Johnston2015-07-071-21/+60
|
* Fix various typosErik Johnston2015-07-071-2/+4
|
* Consolidate duplicate code in notifierErik Johnston2015-07-021-2/+2
|
* Add basic ReceiptHandlerErik Johnston2015-07-011-0/+130