summary refs log tree commit diff
path: root/synapse/push (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Don't push if an user account has expired (#8353)Mathieu Velten2020-09-231-0/+18
|
* 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 `Notifier.on_new_room_event` code path (#8288)Erik Johnston2020-09-101-1/+1
| | | | | | | | | | | | | The idea here is that we pass the `max_stream_id` to everything, and only use the stream ID of the particular event to figure out *when* the max stream position has caught up to the event and we can notify people about it. This is to maintain the distinction between the position of an item in the stream (i.e. event A has stream ID 513) and a token that can be used to partition the stream (i.e. give me all events after stream ID 352). This distinction becomes important when the tokens are more complicated than a single number, which they will be once we start tracking the position of multiple writers in the tokens. The valid operations here are: 1. Is a position before or after a token 2. Fetching all events between two tokens 3. Merging multiple tokens to get the "max", i.e. `C = max(A, B)` means that for all positions P where P is before A *or* before B, then P is before C. Future PR will change the token type to a dedicated type.
* Show a confirmation page during user password reset (#8004)Andrew Morgan2020-09-101-1/+1
| | | | | This PR adds a confirmation step to resetting your user password between clicking the link in your email and your password actually being reset. This is to better align our password reset flow with the industry standard of requiring a confirmation from the user after email validation.
* Fixup pusher pool notifications (#8287)Erik Johnston2020-09-093-5/+18
| | | | | `pusher_pool.on_new_notifications` expected a min and max stream ID, however that was not what we were passing in. Instead, let's just pass it the current max stream ID and have it track the last stream ID it got passed. I believe that it mostly worked as we called the function for every event. However, it would break for events that got persisted out of order, i.e, that were persisted but the max stream ID wasn't incremented as not all preceding events had finished persisting, and push for that event would be delayed until another event got pushed to the effected users.
* Revert "Fixup pusher pool notifications"Erik Johnston2020-09-093-18/+5
| | | | This reverts commit e7fd336a53a4ca489cdafc389b494d5477019dc0.
* Fixup pusher pool notificationsErik Johnston2020-09-093-5/+18
|
* Only add rows to the push actions table if the event notifies or should be ↵Brendan Abolivier2020-09-071-1/+6
| | | | marked unread (#8274)
* Unread counts fixes (#8254)Brendan Abolivier2020-09-041-1/+1
| | | | | | | | | | | | | | * Fixup `ALTER TABLE` database queries Make the new columns nullable, because doing otherwise can wedge a server with a big database, as setting a default value rewrites the table. * Switch back to using the notifications count in the push badge Clients are likely to be confused if we send a push but the badge count is the unread messages one, and not the notifications one. * Changelog
* Stop sub-classing object (#8249)Patrick Cloke2020-09-047-8/+8
|
* Re-implement unread counts (again) (#8059)Brendan Abolivier2020-09-022-29/+65
|
* Use the default templates when a custom template file cannot be found (#8037)Andrew Morgan2020-08-172-95/+8
| | | Fixes https://github.com/matrix-org/synapse/issues/6583
* Implement new experimental push rules (#7997)Brendan Abolivier2020-08-101-8/+208
|\ | | | | With an undocumented configuration setting to enable them for specific users.
| * Incorporate reviewBrendan Abolivier2020-08-061-16/+4
| |
| * LintBrendan Abolivier2020-07-301-19/+32
| |
| * Merge branch 'develop' of github.com:matrix-org/synapse into ↵Brendan Abolivier2020-07-306-148/+97
| |\ | | | | | | | | | babolivier/new_push_rules
| * | Implement new experimental push rules with a database hack to enable themBrendan Abolivier2020-07-281-9/+208
| | |
* | | Revert #7736 (#8039)Brendan Abolivier2020-08-061-4/+13
| | |
* | | Convert synapse.api to async/await (#8031)Patrick Cloke2020-08-061-1/+1
| |/ |/|
* | Re-implement unread counts (#7736)Brendan Abolivier2020-07-291-13/+4
| |
* | Convert push to async/await. (#7948)Patrick Cloke2020-07-276-139/+95
| |
* | Convert state resolution to async/await (#7942)Patrick Cloke2020-07-241-1/+3
|/
* Add ability to run multiple pusher instances (#7855)Erik Johnston2020-07-161-36/+42
| | | This reuses the same scheme as federation sender sharding
* Allow email subjects to be customised through Synapse's configuration (#7846)Brendan Abolivier2020-07-141-31/+20
|
* Correctly pass app_name to all email templates. (#7829)Erik Johnston2020-07-141-2/+8
| | | We didn't do this for e.g. registration emails.
* Don't ignore `set_tweak` actions with no explicit `value`. (#7766)reivilibre2020-07-061-4/+27
| | | | | | | | | | | | | | * Fix spec compliance; tweaks without values are valid (default to True, which is only concretely specified for `highlight`, but it seems only reasonable to generalise) * Changelog for 7766. * Add documentation to `tweaks_for_actions` May as well tidy up when I'm here. * Add a test for `tweaks_for_actions`
* Hack to add push priority to push notifications (#7765)reivilibre2020-07-011-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove obsolete comment about ancient temporary code Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> * Implement hack to set push priority based on whether the tweaks indicate the event might cause effects. * Changelog for 7765 Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> * Antilint * Add tests for push priority Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> * Update synapse/push/httppusher.py Co-authored-by: Brendan Abolivier <babolivier@matrix.org> * Antilint * Remove needless invites from tests. Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Back out MSC2625 implementation (#7761)Brendan Abolivier2020-07-012-9/+3
|
* add a commentRichard van der Hoff2020-06-181-0/+2
|
* Fix unread counts in syncBrendan Abolivier2020-06-171-1/+1
| | | | | * Always return an unread_count in get_unread_event_push_actions_by_room_for_user * Don't always expect unread_count to be there so we don't take out sync entirely if something goes wrong
* Implement unread counter (MSC2625) (#7673)Brendan Abolivier2020-06-172-3/+9
|\ | | | | Implementation of https://github.com/matrix-org/matrix-doc/pull/2625
| * Merge branch 'develop' into babolivier/mark_unreadBrendan Abolivier2020-06-151-8/+6
| |\
| * | Incorporate review bitsBrendan Abolivier2020-06-121-7/+6
| | |
| * | Actually act on mark_unreadBrendan Abolivier2020-06-111-3/+7
| | |
| * | Add a new unread_counter to sync responsesBrendan Abolivier2020-06-101-1/+4
| | |
* | | Refactor getting replication updates from database. (#7636)Erik Johnston2020-06-161-3/+1
| | | | | | | | | The aim here is to make it easier to reason about when streams are limited and when they're not, by moving the logic into the database functions themselves. This should mean we can kill of `db_query_to_update_function` function.
* | | Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-162-5/+2
| | |
* | | Ensure the body is a string before comparing push rules. (#7701)Patrick Cloke2020-06-151-2/+2
| |/ |/|
* | Replace iteritems/itervalues/iterkeys with native versions. (#7692)Patrick Cloke2020-06-151-8/+6
|/
* Convert sending mail to async/await. (#7557)Erik Johnston2020-05-222-69/+53
| | | | Mainly because sometimes the email push code raises exceptions where the stack traces have gotten lost, which is hopefully fixed by this.
* remove miscellaneous PY2 codeRichard van der Hoff2020-05-151-8/+3
|
* Fix new flake8 errors (#7470)Erik Johnston2020-05-121-2/+5
|
* Allow configuration of Synapse's cache without using synctl or environment ↵Amber Brown2020-05-112-3/+5
| | | | variables (#6391)
* Do not treat display names as globs for push rules. (#7271)Patrick Cloke2020-04-161-30/+39
|
* Fix concurrent modification errors in pusher metrics (#7106)Richard van der Hoff2020-03-191-9/+18
| | | add a lock to try to make this metric actually work
* Add prometheus metrics for the number of active pushers (#7103)Richard van der Hoff2020-03-191-1/+23
|
* Fix undefined `room_id` in `make_summary_text`Brendan Abolivier2020-03-091-1/+3
| | | | | This would break notifications about un-named rooms when processing notifications in a batch.
* No longer use room alias events to calculate room names for push ↵Patrick Cloke2020-02-211-22/+14
| | | | notifications. (#6966)
* Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)Patrick Cloke2020-02-214-18/+14
| | | | Ensure good comprehension hygiene using flake8-comprehensions.
* Reduce amount of logging at INFO level. (#6862)Erik Johnston2020-02-061-1/+1
| | | | | | | | A lot of the things we log at INFO are now a bit superfluous, so lets make them DEBUG logs to reduce the amount we log by default. Co-Authored-By: Brendan Abolivier <babolivier@matrix.org> Co-authored-by: Brendan Abolivier <github@brendanabolivier.com>
* Add `local_current_membership` table (#6655)Erik Johnston2020-01-151-1/+1
| | | | | | | Currently we rely on `current_state_events` to figure out what rooms a user was in and their last membership event in there. However, if the server leaves the room then the table may be cleaned up and that information is lost. So lets add a table that separately holds that information.
* Change EventContext to use the Storage class (#6564)Erik Johnston2019-12-201-2/+2
|
* Clean up startup for the pusher (#6558)Richard van der Hoff2019-12-182-9/+13
| | | | | | | | | | | | | | | | | | | | | | | * Remove redundant python2 support code `str.decode()` doesn't exist on python3, so presumably this code was doing nothing * Filter out pushers with corrupt data When we get a row with unparsable json, drop the row, rather than returning a row with null `data`, which will then cause an explosion later on. * Improve logging when we can't start a pusher Log the ID to help us understand the problem * Make email pusher setup more robust We know we'll have a `data` member, since that comes from the database. What we *don't* know is if that is a dict, and if that has a `brand` member, and if that member is a string.
* Don't call SQLBaseStore methods from outside storesErik Johnston2019-12-041-9/+1
|
* Clean up newline quote marks around the codebase (#6362)Andrew Morgan2019-11-212-5/+4
|
* Support for routing outbound HTTP requests via a proxy (#6239)Richard van der Hoff2019-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | The `http_proxy` and `HTTPS_PROXY` env vars can be set to a `host[:port]` value which should point to a proxy. The address of the proxy should be excluded from IP blacklists such as the `url_preview_ip_range_blacklist`. The proxy will then be used for * push * url previews * phone-home stats * recaptcha validation * CAS auth validation It will *not* be used for: * Application Services * Identity servers * Outbound federation * In worker configurations, connections from workers to masters Fixes #4198.
* Update black to 19.10b0 (#6304)Amber Brown2019-11-014-22/+17
| | | * update version of black and also fix the mypy config being overridden
* Merge pull request #6294 from matrix-org/erikj/add_state_storageErik Johnston2019-10-313-6/+9
|\ | | | | Add StateGroupStorage interface
| * Port to use state storageErik Johnston2019-10-303-6/+9
| |
* | Remove usage of deprecated logger.warn method from codebase (#6271)Andrew Morgan2019-10-312-4/+4
|/ | | Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
* Quick fix to ensure cache descriptors always return deferredsErik Johnston2019-10-281-1/+1
|
* Generalize email sending logging (#6075)Andrew Morgan2019-09-231-1/+1
| | | | | | | In ancient times Synapse would only send emails when it was notifying a user about a message they received... Now it can do all sorts of neat things! Change the logging so it's not just about notifications.
* Allow HS to send emails when adding an email to the HS (#6042)Andrew Morgan2019-09-201-0/+29
|
* Ensure email validation link parameters are URL-encoded (#6063)Andrew Morgan2019-09-201-4/+6
| | | The validation links sent via email had their query parameters inserted without any URL-encoding. Surprisingly this didn't seem to cause any issues, but if a user were to put a `/` in their client_secret it could lead to problems.
* Add opentracing span for HTTP pushErik Johnston2019-09-091-1/+12
|
* Allow Synapse to send registration emails + choose Synapse or an external ↵Andrew Morgan2019-09-062-23/+77
| | | | | | | | | | | | | | | | server to handle 3pid validation (#5987) This is a combination of a few different PRs, finally all being merged into `develop`: * #5875 * #5876 * #5868 (This one added the `/versions` flag but the flag itself was actually [backed out](https://github.com/matrix-org/synapse/commit/891afb57cbdf9867f2848341b29c75d6f35eef5a#diff-e591d42d30690ffb79f63bb726200891) in #5969. What's left is just giving /versions access to the config file, which could be useful in the future) * #5835 * #5969 * #5940 Clients should not actually use the new registration functionality until https://github.com/matrix-org/synapse/pull/5972 is merged. UPGRADE.rst, changelog entries and config file changes should all be reviewed closely before this PR is merged.
* 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 :)
* Remove redundant returnErik Johnston2019-08-131-1/+0
|
* Handle pusher being deleted during processing.Erik Johnston2019-08-012-13/+33
| | | | | Instead of throwing a StoreError lets break out of processing loop and mark the pusher as stopped.
* Explicitly check that tombstone is a state event before notifying.Erik Johnston2019-07-311-1/+7
|
* Replace returnValue with return (#5736)Amber Brown2019-07-236-82/+65
|
* Add default push rule to ignore reactions (#5623)J. Ryan Stinnett2019-07-051-0/+13
| | | | | | | This adds a default push rule following the proposal in [MSC2153](https://github.com/matrix-org/matrix-doc/pull/2153). See also https://github.com/vector-im/riot-web/issues/10208 See also https://github.com/matrix-org/matrix-js-sdk/pull/976
* Move logging utilities out of the side drawer of util/ and into logging/ (#5606)Amber Brown2019-07-041-1/+1
|
* Improve email notification logging (#5502)Neil Johnson2019-06-201-1/+1
|
* Run Black. (#5482)Amber Brown2019-06-2013-697/+675
|
* Merge pull request #5388 from matrix-org/erikj/fix_email_pushErik Johnston2019-06-173-7/+53
|\ | | | | Fix email notifications for unnamed rooms with multiple people
| * Add testErik Johnston2019-06-072-7/+42
| |
| * Fix email notifications for large unnamed rooms.Erik Johnston2019-06-071-0/+11
| | | | | | | | | | | | When we try and calculate a description for a room for with no name but multiple other users we threw an exception (due to trying to subscript result of `dict.values()`).
* | Change password reset links to /_matrix.Erik Johnston2019-06-111-1/+1
|/
* Add ability to perform password reset via email without trusting the ↵Andrew Morgan2019-06-062-20/+69
| | | | | | | | | | | | identity server (#5377) Sends password reset emails from the homeserver instead of proxying to the identity server. This is now the default behaviour for security reasons. If you wish to continue proxying password reset requests to the identity server you must now enable the email.trust_identity_server_for_password_resets option. This PR is a culmination of 3 smaller PRs which have each been separately reviewed: * #5308 * #5345 * #5368
* Add a default .m.rule.tombstone push rule (#4867)Travis Ralston2019-04-291-0/+17
| | | | | | | | | | * Add a default .m.rule.tombstone push rule In support of MSC1930: https://github.com/matrix-org/matrix-doc/pull/1930 * changelog * Appease the changelog linter
* Merge pull request #5047 from matrix-org/babolivier/account_expirationBrendan Abolivier2019-04-172-10/+10
|\ | | | | Send out emails with links to extend an account's validity period
| * Send out emails with links to extend an account's validity periodBrendan Abolivier2019-04-172-10/+10
| |
* | Make starting pushers faster during start upErik Johnston2019-04-023-8/+43
|/ | | | | | | | | | | We start all pushers on start up and immediately start a background process to fetch push to send. This makes start up incredibly painful when dealing with many pushers. Instead, let's do a quick fast DB check to see if there *may* be push to send and only start the background processes for those pushers. We also stagger starting up and doing those checks so that we don't try and handle all pushers at once.
* Add missing returnErik Johnston2019-02-221-0/+1
|
* Correctly handle PusherConfigExceptionErik Johnston2019-02-221-0/+9
|
* Drop logging level of creating a pusherErik Johnston2019-02-221-1/+1
|
* Correctly handle null data in HttpPusherErik Johnston2019-02-221-0/+5
|
* Add prometheus metrics for number of badge update pushes. (#4709)Richard van der Hoff2019-02-221-8/+25
| | | | | | We're counting the number of push notifications, but not the number of badges; I'd like to see if they are significant.
* bail out early in on_new_receipts if no pushers (#4706)Richard van der Hoff2019-02-211-0/+8
|
* Logging improvements for the pusher (#4691)Richard van der Hoff2019-02-202-13/+14
|
* Fix flake8 (#4519)Amber Brown2019-01-301-1/+1
|
* Fix logcontext leak in EmailPusherRichard van der Hoff2018-11-191-2/+3
|
* Clean up event accesses and testsErik Johnston2018-11-022-4/+4
| | | | | This is in preparation to refactor FrozenEvent to support different event formats for different room versions
* Write some tests for the email pusher (#4095)Amber Brown2018-10-302-6/+9
|
* Fix start_pushers vs _start_pushers confusionRichard van der Hoff2018-10-241-3/+3
|
* sanity-check the is_processing flagRichard van der Hoff2018-10-242-8/+14
| | | | ... and rename it, for even more sanity
* Run PusherPool.start as a background processRichard van der Hoff2018-10-221-5/+7
| | | | | We don't do anything with the result, so this is needed to give this code a logcontext.
* Make on_started synchronous tooRichard van der Hoff2018-10-223-11/+21
| | | | | | This brings it into line with on_new_notifications and on_new_receipts. It requires a little bit of hoop-jumping in EmailPusher to load the throttle params before the first loop.
* Remove redundant run_as_background_process() from pusherpoolRichard van der Hoff2018-10-223-44/+8
| | | | | | | `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.
* Give pushers their own background logcontextRichard van der Hoff2018-10-222-58/+54
| | | | | | | | Each pusher has its own loop which runs for as long as it has work to do. This should run in its own background thread with its own logcontext, as other similar loops elsewhere in the system do - which means that CPU usage is consistently attributed to that loop, rather than to whatever request happened to start the loop.
* move get_all_pushers call downRichard van der Hoff2018-10-221-3/+9
| | | | simplifies the interface to _start_pushers
* Factor PusherPool._start_pusher out of _start_pushersRichard van der Hoff2018-10-221-18/+33
| | | | | ... and use it from start_pusher_by_id. This mostly simplifies start_pusher_by_id.
* Rename _refresh_pusherRichard van der Hoff2018-10-221-2/+3
| | | | | This is public (or at least, called from outside the class), so ought to have a better name.
* Calculate absolute path for email templatesRichard van der Hoff2018-10-191-6/+2
|
* Ship the email templates as package_dataRichard van der Hoff2018-10-171-1/+4
| | | | | | | | | | move the example email templates into the synapse package so that they can be used as package data, which should mean that all of the packaging mechanisms (pip, docker, debian, arch, etc) should now come with the example templates. In order to grandfather in people who relied on the templates being in the old place, check for that situation and fall back to using the defaults if the templates directory does not exist.
* fix link for case that config.email_riot_base_url is setNeil Johnson2018-09-131-1/+1
|
* merge (#3576)Amber Brown2018-09-142-4/+10
|
* Fix logcontexts for running pushersRichard van der Hoff2018-08-171-2/+15
| | | | | | | 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.
* Rename async to async_helpers because `async` is a keyword on Python 3.7 (#3678)Amber Brown2018-08-102-2/+2
|
* Use new gettersErik Johnston2018-07-231-3/+4
|
* run isortAmber Brown2018-07-0911-48/+48
|
* Remove all global reactor imports & pass it around explicitly (#3424)Amber Brown2018-06-252-4/+6
|
* Remove run_on_reactor (#3395)Amber Brown2018-06-141-3/+0
|
* Consistently use six's iteritems and wrap lazy keys/values in list() if ↵Amber Brown2018-05-313-3/+4
| | | | they're not meant to be lazy (#3307)
* Merge remote-tracking branch 'origin/develop' into 3218-official-promAmber Brown2018-05-282-7/+10
|\
| * Merge pull request #3244 from NotAFile/py3-six-4Amber Brown2018-05-241-6/+7
| |\ | | | | | | replace some iteritems with six
| | * replace some iteritems with sixAdrian Tschira2018-05-191-6/+7
| | | | | | | | | | | | Signed-off-by: Adrian Tschira <nota@notafile.com>
| * | Replace some more comparisons with sixAdrian Tschira2018-05-191-1/+3
| |/ | | | | | | | | | | plus a bonus b"" string I missed last time Signed-off-by: Adrian Tschira <nota@notafile.com>
* | fixesAmber Brown2018-05-231-2/+2
| |
* | cleanupAmber Brown2018-05-221-2/+4
| |
* | fixesAmber Brown2018-05-221-2/+2
| |
* | rest of the changesAmber Brown2018-05-211-17/+11
| |
* | replacing portionsAmber Brown2018-05-212-10/+5
|/
* Merge pull request #3152 from NotAFile/py3-local-importsRichard van der Hoff2018-04-302-3/+3
|\ | | | | make imports local
| * make imports localAdrian Tschira2018-04-282-3/+3
| | | | | | | | Signed-off-by: Adrian Tschira <nota@notafile.com>
* | Merge remote-tracking branch 'origin/develop' into rav/use_run_in_backgroundRichard van der Hoff2018-04-273-7/+17
|\|
| * Merge pull request #3138 from matrix-org/rav/catch_unhandled_exceptionsRichard van der Hoff2018-04-272-5/+11
| |\ | | | | | | Improve exception handling for background processes
| | * Improve exception handling for background processesRichard van der Hoff2018-04-272-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Add missing consumeErrorsRichard van der Hoff2018-04-271-2/+6
| |/ | | | | | | | | In general we want defer.gatherResults to consumeErrors, rather than having exceptions hanging around and getting logged as CRITICAL unhandled errors.
* / Use run_in_background in preference to preserve_fnRichard van der Hoff2018-04-271-8/+12
|/ | | | | | While I was going through uses of preserve_fn for other PRs, I converted places which only use the wrapped function once to use run_in_background, to avoid creating the function object.
* Update commentsErik Johnston2018-02-211-3/+4
|
* Batch inserts into event_push_actions_stagingErik Johnston2018-02-201-6/+9
|
* CommentsErik Johnston2018-02-161-0/+3
|
* Remove context.push_actionsErik Johnston2018-02-152-11/+4
|
* Store push actions in staging areaErik Johnston2018-02-151-0/+3
|
* Better logging when pushes failRichard van der Hoff2018-01-291-2/+8
|
* add appid/device_display_name to to pusher loggingRichard van der Hoff2018-01-291-2/+2
|
* Fix logging and add user_idRichard van der Hoff2018-01-221-2/+3
|
* logging and debug for http pusherRichard van der Hoff2018-01-221-4/+20
|
* Remove pushers when deleting access tokensRichard van der Hoff2017-11-291-9/+15
| | | | | Whenever an access token is invalidated, we should remove the associated pushers.
* Merge pull request #2675 from matrix-org/rav/remove_broken_logcontext_funcsRichard van der Hoff2017-11-151-3/+3
|\ | | | | Remove preserve_context_over_{fn, deferred}
| * Remove preserve_context_over_{fn, deferred}Richard van der Hoff2017-11-141-3/+3
| | | | | | | | | | Both of these functions ae known to leak logcontexts. Replace the remaining calls to them and kill them off.
* | Rename redact_content option to include_contentDavid Baker2017-11-081-1/+2
|/ | | | | | | | | | | | | | | | | | The redact_content option never worked because it read the wrong config section. The PR introducing it (https://github.com/matrix-org/synapse/pull/2301) had feedback suggesting the name be changed to not re-use the term 'redact' but this wasn't incorporated. This reanmes the option to give it a less confusing name, and also means that people who've set the redact_content option won't suddenly see a behaviour change when upgrading synapse, but instead can set include_content if they want to. This PR also updates the wording of the config comment to clarify that this has no effect on event_id_only push. Includes https://github.com/matrix-org/synapse/pull/2422
* replace 'except:' with 'except Exception:'Richard van der Hoff2017-10-234-8/+8
| | | | what could possibly go wrong
* Omit the *s for @room notificationsDavid Baker2017-10-161-1/+1
| | | | They're just redundant
* pep8David Baker2017-10-102-3/+5
|
* Don't KeyError if no power_levels eventDavid Baker2017-10-101-1/+3
|
* Use notification levels in power_levelsDavid Baker2017-10-103-12/+22
| | | | | | Rather than making the condition directly require a specific power level. This way the level require to notify a room can be configured per room.
* There was already a constant for thisDavid Baker2017-10-101-3/+4
| | | | also update copyright
* More optimisationDavid Baker2017-10-101-6/+9
|
* What year is it!? Who's the president!?David Baker2017-10-101-1/+1
|
* Make be fasterDavid Baker2017-10-051-3/+3
|
* Add fastpath optimisationDavid Baker2017-10-051-3/+9
|
* pep8David Baker2017-10-051-0/+3
|
* They're called roomsDavid Baker2017-10-051-4/+4
|
* Get rule type rightDavid Baker2017-10-051-1/+1
|
* Support for channel notificationsDavid Baker2017-10-053-8/+59
| | | | | Add condition type to check the sender's power level and add a base rule using it for @channel notifications.
* Use better method for word boundary searchingDavid Baker2017-10-051-11/+3
| | | | From https://github.com/matrix-org/matrix-js-sdk/commit/ebc95667b8a5777d13e5d3c679972bedae022fd5
* pep8David Baker2017-10-051-0/+1
|
* Fix notif kws that start/end with non-word charsDavid Baker2017-10-051-2/+21
| | | | | | | Only prepend / append word bounary characters if the search expression starts or ends with a word character, otherwise they don't work because there's no word bounary between whitespace and a non-word char.
* Also include the room_idDavid Baker2017-09-181-0/+1
| | | | as really it's part of the event ID
* Use .get - it's much shorterDavid Baker2017-09-181-1/+1
|
* Add support for event_id_only push formatDavid Baker2017-09-181-0/+19
| | | | | | | Param in the data dict of a pusher that tells an HTTP pusher to send just the event_id of the event it's notifying about and the notification counts. For clients that want to go & fetch the body of the event themselves anyway.
* Increase cache hit ratio for pushErik Johnston2017-07-141-0/+8
| | | | | We don't update the cache in all code paths, which causes subsequent calls to miss the cache
* Add more metrics to push rule evaluationErik Johnston2017-07-131-2/+42
|
* Push: Don't acquire lock unless necessaryErik Johnston2017-07-131-0/+4
|
* Perf: Don't filter events for pushErik Johnston2017-07-071-17/+8
| | | | | We know the users are joined and we can explicitly check for if they are ignoring the user, so lets do that.
* Merge pull request #2332 from matrix-org/rav/fix_pushesRichard van der Hoff2017-07-051-1/+3
|\ | | | | Fix caching error in the push evaluator
| * Fix caching error in the push evaluatorRichard van der Hoff2017-07-051-1/+3
| | | | | | | | | | | | | | | | | | | | Initialising `result` to `{}` in the parameters meant that every call to _flatten_dict used the *same* target dictionary. I'm hopeful this will fix https://github.com/matrix-org/synapse/issues/2270, but I suspect it won't. (This code seems to have been here since forever, unlike the bug, and I don't really think it explains the observed behaviour). Still, it makes it hard to investigate the problem.
* | Fix TravisCI tests for PR #2301Caleb James DeLisle2017-06-231-1/+1
| |
* | Add configuration parameter to allow redaction of content from push messages ↵Caleb James DeLisle2017-06-231-1/+1
|/ | | | for google/apple devices
* Fix typo when getting app nameErik Johnston2017-06-061-1/+1
|
* Fix wrong number of argumentsErik Johnston2017-06-061-1/+1
|
* Only load jinja2 templates onceErik Johnston2017-05-224-60/+105
| | | | | Instead of every time a new email pusher is created, as loading jinja2 templates is slow.
* CommentErik Johnston2017-05-221-0/+2
|
* Remove spurious log level guardsErik Johnston2017-05-221-6/+3
|
* Check if current event is a membership eventErik Johnston2017-05-221-4/+9
|
* Add debug loggingErik Johnston2017-05-221-0/+24
|
* CommentErik Johnston2017-05-221-1/+4
|
* Use tuple unpackingErik Johnston2017-05-221-2/+2
|
* Speed up calculating push rulesErik Johnston2017-05-191-8/+19
|
* Move invalidation cb to its own structureErik Johnston2017-05-191-6/+15
|
* Store ActionGenerator in HomeServerErik Johnston2017-05-192-2/+2
|
* Don't push users who have leftErik Johnston2017-05-181-1/+4
|
* Make get_if_app_services_interested_in_user fasterErik Johnston2017-05-181-3/+1
|
* Remove size of push get_rules cacheErik Johnston2017-05-181-1/+1
|
* Add commentErik Johnston2017-05-181-0/+3
|
* Faster push rule calculation via push specific cacheErik Johnston2017-05-172-45/+246
| | | | | We add a push rule specific cache that ensures that we can reuse calculated push rules appropriately when a user join/leaves.
* Revert "Speed up filtering of a single event in push"Erik Johnston2017-05-081-8/+19
| | | | This reverts commit 421fdf74609439edaaffce117436e6a6df147841.
* Speed up filtering of a single event in pushErik Johnston2017-04-281-19/+8
|
* fix upErik Johnston2017-04-251-1/+2
|
* Don't specify default as dictErik Johnston2017-04-251-1/+1
|
* Reduce size of joined_user cacheErik Johnston2017-04-251-2/+5
| | | | | | | | The _get_joined_users_from_context cache stores a mapping from user_id to avatar_url and display_name. Instead of storing those in a dict, store them in a namedtuple as that uses much less memory. We also try converting the string to ascii to further reduce the size.
* Support authenticated SMTPDaniel Dent2017-04-051-1/+5
| | | | | | Closes (SYN-714) #1385 Signed-off-by: Daniel Dent <matrixcontrib@contactdaniel.net>
* Merge pull request #2075 from matrix-org/erikj/cache_speedErik Johnston2017-03-311-5/+2
|\ | | | | Speed up cached function access
| * Don't convert to deferreds when not necessaryErik Johnston2017-03-301-5/+2
| |
* | Cache glob to regex at a higher level for pushErik Johnston2017-03-291-47/+57
|/
* Don't recreate so many setsErik Johnston2017-03-161-4/+4
|
* Get current state by using current_state_events tableErik Johnston2017-03-101-1/+1
|
* Ensure we pass positive ints to delay functionErik Johnston2017-02-221-1/+2
|
* Fix email push in pusher workerErik Johnston2017-02-021-2/+2
| | | | | | This was broken when device list updates were implemented, as Mailer could no longer instantiate an AuthHandler due to a dependency on federation sending.
* Merge pull request #1811 from aperezdc/unhardcode-riot-urlsDavid Baker2017-01-181-6/+14
|\ | | | | Allow configuring the Riot URL used in notification emails
| * Allow configuring the Riot URL used in notification emailsAdrian Perez de Castro2017-01-131-6/+14
| | | | | | | | | | | | | | | | | | | | The URLs used for notification emails were hardcoded to use either matrix.to or vector.im; but for self-hosted setups where Riot is also self-hosted it may be desirable to allow configuring an alternative Riot URL. Fixes #1809. Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
* | Get state at event rather than for room in pushErik Johnston2017-01-171-1/+1
|/
* Add /room/<room_id>/joined_members APIErik Johnston2016-12-081-6/+6
| | | | | | This returns the currently joined members in the room with their display names and avatar urls. This is more efficient than /members for large rooms where you don't need the full events.
* Fix push notifications for a single unread messageErik Johnston2016-10-181-1/+1
|
* Reduce redundant database work in email pusherErik Johnston2016-10-181-0/+4
| | | | | | | Update the last stream ordering if the `get_unread_push_actions_for_user_in_range_for_email` returns no new push actions. This reduces the range that it needs to check next iteration.
* Fix email push notifs being droppedErik Johnston2016-10-131-14/+25
| | | | | | | | A lot of email push notifications were failing to be sent due to an exception being thrown along one of the (many) paths. This was due to a change where we moved from pulling out the full state for each room, but rather pulled out the event ids for the state and separately loaded the full events when needed.
* _id field must uniquely identify different conditionsErik Johnston2016-09-191-2/+2
|
* proposal for notifying on e2e eventsMatthew Hodgson2016-09-171-0/+49
|
* Ensure we don't mutate the cache of push rulesErik Johnston2016-09-151-9/+1
|
* Make bulk_get_push_rules_for_room use get_joined_users_from_context cacheErik Johnston2016-09-051-1/+1
|
* Merge pull request #1060 from matrix-org/erikj/state_idsErik Johnston2016-09-011-1/+1
|\ | | | | Assign state groups in state handler.
| * Correctly handle the difference between prev and current stateErik Johnston2016-08-311-1/+1
| |
* | Fix email notifs by adding missing paramErik Johnston2016-08-301-1/+1
|/
* Fix push room names for rooms with only an aliasErik Johnston2016-08-301-1/+1
|
* Use state handler instead of get_users_in_room/get_joined_hostsErik Johnston2016-08-261-1/+1
|
* Fix room name in email notifsErik Johnston2016-08-261-19/+20
|
* TypoErik Johnston2016-08-261-1/+0
|
* Fix up push to use get_current_state_idsErik Johnston2016-08-254-20/+226
|
* Replace context.current_state with context.current_state_idsErik Johnston2016-08-252-19/+17
|
* Preserve some logcontextsErik Johnston2016-08-242-9/+12
|
* Move _bulk_get_push_rules_for_room to storage layerErik Johnston2016-08-192-34/+9
|
* Make push Measure finer grainedErik Johnston2016-08-171-4/+5
|
* Merge remote-tracking branch 'origin/develop' into ↵David Baker2016-08-161-4/+4
|\ | | | | | | dbkr/contains_display_name_override
| * Refactor user_delete_access_tokens. Invalidate get_user_by_access_token to ↵Erik Johnston2016-08-151-4/+4
| | | | | | | | slaves.
* | s/underride/override/ in the rule_id tooDavid Baker2016-08-161-1/+1
| |
* | Move display name ruleDavid Baker2016-08-151-16/+20
|/ | | | As per https://github.com/matrix-org/matrix-doc/pull/373 and comment
* Ignore AlreadyCalled errors on timer cancelErik Johnston2016-07-312-3/+16
|
* Create separate methods for getting messages to pushMark Haines2016-07-282-4/+4
| | | | | | | | | | | for the email and http pushers rather than trying to make a single method that will work with their conflicting requirements. The http pusher needs to get the messages in ascending stream order, and doesn't want to miss a message. The email pusher needs to get the messages in descending timestamp order, and doesn't mind if it misses messages.
* TypoDavid Baker2016-07-281-1/+1
|
* even more pep8David Baker2016-06-241-0/+1
|
* Use similar naming we use in email notifs for pushDavid Baker2016-06-242-20/+22
| | | | Fixes https://github.com/vector-im/vector-web/issues/1654
* Fix ``KeyError: 'msgtype'``. Use ``.get``Mark Haines2016-06-171-14/+15
| | | | | | | | | | | | | Fixes a key error where the mailer tried to get the ``msgtype`` of an event that was missing a ``msgtype``. ``` File "synapse/push/mailer.py", line 264, in get_notif_vars File "synapse/push/mailer.py", line 285, in get_message_vars File ".../frozendict/__init__.py", line 10, in __getitem__ return self.__dict[key] KeyError: 'msgtype' ```
* Remove dead code.Mark Haines2016-06-072-34/+0
| | | | | | | | | | | Loading push rules now happens in the datastore, so we can remove the methods that loaded them outside the datastore. The ``waiting_for_join_list`` in federation handler is populated by anything, so can be removed. The ``_get_members_events_txn`` method isn't called from anywhere so can be removed.
* 3rd time lucky: we'd already calculated it aboveDavid Baker2016-06-031-3/+1
|
* Oops, we're using the dict formDavid Baker2016-06-031-1/+3
|
* Add substitutions to email notif FromDavid Baker2016-06-031-1/+1
|
* Merge branch 'develop' into matthew/brand-from-headerMatthew Hodgson2016-06-035-61/+67
|\
| * Load push rules in storage layer, so that they get cachedErik Johnston2016-06-032-36/+22
| |
| * Remove unnecessary setsErik Johnston2016-06-031-6/+3
| |
| * Only get local usersErik Johnston2016-06-031-2/+5
| |
| * Merge pull request #811 from matrix-org/erikj/state_users_in_roomErik Johnston2016-06-032-11/+18
| |\ | | | | | | Use state to calculate get_users_in_room
| | * Use state to calculate get_users_in_roomErik Johnston2016-06-012-11/+18
| | |
| * | Merge pull request #809 from matrix-org/erikj/cache_receipts_in_roomErik Johnston2016-06-031-4/+4
| |\| | | | | | | Add get_users_with_read_receipts_in_room cache
| | * Add get_users_with_read_receipts_in_room cacheErik Johnston2016-06-011-4/+4
| | |
| * | Merge pull request #821 from matrix-org/dbkr/email_unsubscribeDavid Baker2016-06-022-6/+19
| |\ \ | | | | | | | | Email unsubscribe links that don't require logging in
| | * | peppateDavid Baker2016-06-021-1/+3
| | | |
| | * | Working unsubscribe links going straight to the HSDavid Baker2016-06-021-4/+4
| | | | | | | | | | | | | | | | and authed by macaroons that let you delete pushers and nothing else