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

Remove obsolete references to device-specific push rules #3967

Conversation

jgarplind
Copy link
Contributor

@jgarplind jgarplind commented Dec 18, 2023

Checklist

  • Tests written for new code (and old code if feasible) Should be covered by existing tests, if any
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

Been reading up on push rules, and specifically how the only supported (as per the spec) scope is global, e.g. here: matrix-org/matrix-spec#637

I also found this old PR which did the most important parts, but then ran across some parts that unnecessarily catered for a no longer supported use case. Figured it could be a good opportunity to make a minor contribution to a much appreciated repo.

I also considered the possibility to adjust the function signatures to either not take scope, or to force it to be the literal "global", but I'm not sure if that is desirable, with regards to API stability, etc.

Type: [task]


This PR currently has none of the required changelog labels.

A reviewer can add one of: T-Deprecation, T-Enhancement, T-Defect, T-Task to indicate what type of change this is, or add Type: [enhancement/defect/task] to the description and I'll add them for you.

@jgarplind jgarplind requested a review from a team as a code owner December 18, 2023 14:44
@github-actions github-actions bot added Z-Community-PR Issue is solved by a community member's PR T-Task Tasks for the team like planning labels Dec 18, 2023
Comment on lines -8808 to +8809
// NB. Scope not uri encoded because devices need the '/'
const path = utils.encodeUri("/pushrules/" + scope + "/$kind/$ruleId", {
const path = utils.encodeUri("/pushrules/$scope/$kind/$ruleId", {
$scope: scope,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see that this is a worthwhile improvement. It doesn't actually remove the redundant scope param (which would be a concrete improvement, though hard to do without breaking backwards compatibility); rather it just url-encodes it. Since scope must always be global, this seems to make no difference at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. It is a miniscule improvement to legibility / removing redundant comments which may confuse, and the PR description echoes your sentiment about preserving backwards compatibility.

Was hoping that a small touch-up would be appreciated, but if you prefer to keep things as they are, I'm content to cancel this PR as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's leave it; I don't think it's worthwhile.

Maybe in future we can create addGlobalPushRule etc which omit the scope param; then we can deprecate the existing methods.

@richvdh
Copy link
Member

richvdh commented Jan 3, 2024

Thanks for the contribution anyway!

@richvdh richvdh closed this Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Tasks for the team like planning Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants