Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(DRAFT) Fix global notification rules by using /pushrules instead of /m.push_rules #2093

Closed

Conversation

LevitatingBusinessMan
Copy link
Contributor

Description

The ability to set account for event types changed. See https://spec.matrix.org/v1.12/client-server-api/#server-behaviour-12.

The correct api is documented here: https://spec.matrix.org/v1.12/client-server-api/#push-rules-api.

fixes #2034

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Copy link

Preview: https://2093--pr-cinny.netlify.app
⚠️ Exercise caution. Use test accounts. ⚠️

@LevitatingBusinessMan LevitatingBusinessMan changed the title Use /pushrules instead of /m.push_rules for setting push rules account data Fix global notification rules by using /pushrules instead of /m.push_rules Dec 14, 2024
@LevitatingBusinessMan
Copy link
Contributor Author

LevitatingBusinessMan commented Dec 14, 2024

Hmm I am not entirely sure that it is applying the setting correctly in practice. I will have to do a bit more testing.

@tulir
Copy link

tulir commented Dec 15, 2024

I don't know how matrix-js-sdk works, but the change looks completely wrong (unless matrix-js-sdk has some weird hacks that make it work)

m.push_rules is the correct account data type, the problem is that account data endpoints can't be used to modify push rules. Modifying has to be done with push rule endpoints (PUT/DELETE /_matrix/client/v3/pushrules/...) instead of account data endpoints (/_matrix/client/v3/user/.../account_data/...)

Getting push rules via account data calls should be fine though

@LevitatingBusinessMan
Copy link
Contributor Author

Hmm @tulir I think you're right and I will dig into it a bit deeper.

I kind of just winged this change, and superficially it appeared to work. There's no errors or warnings created, setting the data with PUT .../account_data/pushrules returns a 200.

And I thought the code also fetched the set value, but it doesn't and the changed value appears to only be present locally.

I'll mark the PR a draft and then redo it sometime next week.

@LevitatingBusinessMan LevitatingBusinessMan changed the title Fix global notification rules by using /pushrules instead of /m.push_rules (DRAFT) Fix global notification rules by using /pushrules instead of /m.push_rules Dec 15, 2024
@ajbura
Copy link
Member

ajbura commented Dec 16, 2024

I am working on the settings rework and currently going through notifications section, its going to fix in it. #1988

@LevitatingBusinessMan
Copy link
Contributor Author

Great, in that case I'll just close this.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect push_rules endpoint for notifications
3 participants