element-hq / element-hq/dendrite
Implement clarifications for the `PUT _matrix/client/v3/pushrules/{scope}/{kind}/{ruleID}` endpoint
- Dominant language
- Go
- Stars
- 965
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
*This issue was originally created by [**@zecakeh**](https://github.com/zecakeh) at .*
Two PRs were merged lately with clarifications to push rules, and specifically the `PUT _matrix/client/v3/pushrules/{scope}/{kind}/{ruleID}` endpoint:
- https://github.com/matrix-org/matrix-spec/pull/1319
- https://github.com/matrix-org/matrix-spec/pull/1320
Although those were partly based on Dendrite's behavior, a few changes are needed in [`PutPushRuleByRuleID`](https://github.com/matrix-org/dendrite/blob/506de4bb3d69fef27e60d09d06712a72e588a198/clientapi/routing/pushrules.go#L101-L161) to be spec-compliant:
1. The rule ID cannot start with a dot as it's reserved for default push rules, and those cannot be overriden.
2. `m.rule.master` is always the rule with the highest priority, even higher than user-defined ones.
I believe a database migration needs to be written to make sure that no server-default pushrules were overriden and `m.rule.master` is the first.
Contributor guide
Research direction
Start in clientapi/routing/pushrules.go at PutPushRuleByRuleID, then read the two referenced Matrix spec pull requests for the endpoint clarifications. Check how existing push rules are stored and whether a database migration is needed; done means leading-dot rule IDs cannot override defaults, m.rule.master has the highest priority, and existing data is corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100