summary refs log tree commit diff
path: root/synapse/push/push_rule_evaluator.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Implement push rule evaluation in Rust. (#13838)Erik Johnston2022-09-291-361/+0
|
* fix: Push notifications for invite over federation (#13719)Kateřina Churanová2022-09-281-8/+8
|
* Make push rules use proper structures. (#13522)Erik Johnston2022-08-161-8/+19
| | | | | | | | | | | | This improves load times for push rules: | Version | Time per user | Time for 1k users | | -------------------- | ------------- | ----------------- | | Before | 138 µs | 138ms | | Now (with custom) | 2.11 µs | 2.11ms | | Now (without custom) | 49.7 ns | 0.05 ms | This therefore has a large impact on send times for rooms with large numbers of local users in the room.
* Experimental support for MSC3772 (#12740)Patrick Cloke2022-05-241-1/+49
| | | | | | | | | | 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.
* Move free functions into PushRuleEvaluatorForEvent. (#12677)Patrick Cloke2022-05-101-4/+66
| | | | | | * Move `_condition_checker` into `PushRuleEvaluatorForEvent`. * Move the condition cache into `PushRuleEvaluatorForEvent`. * Improve docstrings. * Inline a method which is only called once.
* Fix `PushRuleEvaluator` and `Filter` to work on frozendicts (#12100)Richard van der Hoff2022-02-281-4/+4
| | | | | | | | | | * Fix `PushRuleEvaluator` to work on frozendicts frozendicts do not (necessarily) inherit from dict, so this needs to handle them correctly. * Fix event filtering for frozen events Looks like this one was introduced by #11194.
* Re-apply: Move glob_to_regex and re_word_boundary to matrix-python-common ↵reivilibre2022-01-051-3/+4
| | | | | #11505 (#11687) Co-authored-by: Sean Quah <seanq@element.io>
* Revert "Move `glob_to_regex` and `re_word_boundary` to ↵Sean Quah2021-12-071-4/+3
| | | | | | `matrix-python-common` (#11505) (#11527) This reverts commit a77c36989785c0d5565ab9a1169f4f88e512ce8a.
* Move `glob_to_regex` and `re_word_boundary` to `matrix-python-common` (#11505)Sean Quah2021-12-061-3/+4
|
* Add remaining type hints to `synapse.events`. (#11098)Patrick Cloke2021-11-021-5/+5
|
* Use inline type hints in various other places (in `synapse/`) (#10380)Jonathan de Jong2021-07-151-2/+2
|
* Merge pull request from GHSA-x345-32rc-8h85Richard van der Hoff2021-05-111-52/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests for push rule pattern matching * tests for acl pattern matching * factor out common `re.escape` * Factor out common re.compile * Factor out common anchoring code * add word_boundary support to `glob_to_regex` * Use `glob_to_regex` in push rule evaluator NB that this drops support for character classes. I don't think anyone ever used them. * Improve efficiency of globs with multiple wildcards The idea here is that we compress multiple `*` globs into a single `.*`. We also need to consider `?`, since `*?*` is as hard to implement efficiently as `**`. * add assertion on regex pattern * Fix mypy * Simplify glob_to_regex * Inline the glob_to_regex helper function Signed-off-by: Dan Callahan <danc@element.io> * Moar comments Signed-off-by: Dan Callahan <danc@element.io> Co-authored-by: Dan Callahan <danc@element.io>
* 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>`
* Add type hints to the push module. (#8901)Patrick Cloke2020-12-111-6/+22
|
* Apply suggestions from code reviewRichard van der Hoff2020-10-161-1/+1
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* type annotations for LruCacheRichard van der Hoff2020-10-161-7/+9
|
* Make LruCache register its own metrics (#8561)Richard van der Hoff2020-10-161-3/+1
| | | | | rather than have everything that instantiates an LruCache manage metrics separately, have LruCache do it itself.
* Enable mypy checking for unreachable code and fix instances. (#8432)Patrick Cloke2020-10-011-2/+2
|
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* 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`
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-161-3/+1
|
* Ensure the body is a string before comparing push rules. (#7701)Patrick Cloke2020-06-151-2/+2
|
* Allow configuration of Synapse's cache without using synctl or environment ↵Amber Brown2020-05-111-2/+2
| | | | variables (#6391)
* Do not treat display names as globs for push rules. (#7271)Patrick Cloke2020-04-161-30/+39
|
* Remove usage of deprecated logger.warn method from codebase (#6271)Andrew Morgan2019-10-311-2/+2
| | | Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
* Run Black. (#5482)Amber Brown2019-06-201-31/+26
|
* Clean up event accesses and testsErik Johnston2018-11-021-2/+2
| | | | | This is in preparation to refactor FrozenEvent to support different event formats for different room versions
* run isortAmber Brown2018-07-091-2/+2
|
* Merge remote-tracking branch 'origin/develop' into 3218-official-promAmber Brown2018-05-281-1/+3
|\
| * 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>
* | replacing portionsAmber Brown2018-05-211-1/+1
|/
* pep8David Baker2017-10-101-1/+1
|
* Use notification levels in power_levelsDavid Baker2017-10-101-6/+14
| | | | | | 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.
* What year is it!? Who's the president!?David Baker2017-10-101-1/+1
|
* pep8David Baker2017-10-051-0/+3
|
* Support for channel notificationsDavid Baker2017-10-051-7/+18
| | | | | 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.
* 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.
* Cache glob to regex at a higher level for pushErik Johnston2017-03-291-47/+57
|
* Remove code that's now been obsoleted or moved elsewhereDavid Baker2016-04-071-126/+8
|
* Don't ignore the obey overlay if the rule has an enabled attribute of FalseDavid Baker2016-03-311-2/+3
| | | | Fixes https://github.com/vector-im/vector-web/issues/1244
* Fix relative imports so they work in both py3 and py27Mark Haines2016-03-081-2/+2
|
* Remove dead code for setting device specific rules.Mark Haines2016-02-181-10/+5
| | | | | | It wasn't possible to hit the code from the API because of a typo in parsing the request path. Since no-one was using the feature we might as well remove the dead code.
* Fix flake8 warnings for new flake8Daniel Wagner-Hall2016-02-021-1/+1
|
* Change regex cache size to 5000Erik Johnston2016-01-191-1/+1
|
* Add regex cache. Only caculate push actions for users that have sent read ↵Erik Johnston2016-01-191-3/+17
| | | | receipts, and are on that server
* Handle glob -> regex errorsErik Johnston2016-01-191-29/+33
|
* Preserve truthinessErik Johnston2016-01-181-1/+2
|
* You need to escape backslashesErik Johnston2016-01-181-2/+2
|
* Fix branch didn't check word_boundaryErik Johnston2016-01-181-3/+9
|
* Don't split at word boundaries, actually use regexErik Johnston2016-01-181-62/+47
|
* Drop log levelsErik Johnston2016-01-181-2/+2
|
* Add comments and remove dead codeErik Johnston2016-01-181-12/+11
|
* Use static for const dictsErik Johnston2016-01-181-6/+14
|
* Don't edit rulesetErik Johnston2016-01-181-5/+4
|
* Make notifications go quickerErik Johnston2016-01-181-76/+150
|
* Rename 'user_name' to 'user_id' in push to make it consistent with the rest ↵Mark Haines2016-01-131-12/+12
| | | | of the code
* Merge pull request #456 from matrix-org/store_event_actionsDavid Baker2016-01-081-7/+15
|\ | | | | Send unread notification counts
| * Add bulk push rule evaluator which actually still evaluates rules one by ↵David Baker2015-12-221-5/+8
| | | | | | | | one, but does far fewer db queries to fetch the rules
| * Store nothing instead of ['dont_notify'] for events with no notification ↵David Baker2015-12-101-2/+7
| | | | | | | | required: much as it would be nice to be able to tell between the event not having been processed and there being no notification for it, this isn't worth filling up the table with ['dont_notify'] I think. Consequently treat the empty actions array as dont_notify and filter dont_notify out of the result.
* | copyrightsMatthew Hodgson2016-01-071-1/+1
|/
* Split out the push rule evaluator into a separate file so it can be more ↵David Baker2015-12-091-0/+224
readily reused. Should be functionally identical.