@tsteur opened this Pull Request on June 29th 2021 Member

Description:

Needed for some plugin. Adding &editsiteid=\d+ should open the specified site directly. There may be edge cases where multiple sites match a searched number maybe but that be edge case as it likely would be only an issue if > 10 sites matched the specified number. Basically, the URL parameter triggers a search for that number / idsite and the site will be opened directly.

Review

  • [ ] Functional review done
  • [ ] Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • [ ] Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • [ ] Security review done see checklist
  • [ ] Code review done
  • [ ] Tests were added if useful/possible
  • [ ] Reviewed for breaking changes
  • [ ] Developer changelog updated if needed
  • [ ] Documentation added if needed
  • [ ] Existing documentation updated if needed
@diosmosis commented on June 30th 2021 Member

Works for me locally. I'm wondering if we should remove the editsiteid parameter after the user finished editing, otherwise the parameter might stick around and open the same site the next time they visit the manage measurables page.

@tsteur commented on July 1st 2021 Member

good point @diosmosis 👍 changed it and also refactored slightly to have less duplicated code.

To be able to change the URL I had to move the id from a search query parameter to a hash so I can remove it without reloading the page. When saving or canceling then I remove the hash but not removing the search query as it's tricky to do and not really needed for now as this link will be used extremely rare. People can in worst case always click on left menu again to get all sites I reckon.

This Pull Request was closed on July 1st 2021
Powered by GitHub Issue Mirror