matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.92k stars 2.66k forks source link

[Bug] When deleting currently selected site, and you delete that site, an error shows up #22788

Open tsteur opened 14 hours ago

tsteur commented 14 hours ago

What happened?

An error shows up and you can't use Matomo anymore when you delete the currently selected site. When you try to go back every previous page will show an error too because the site has been deleted.

What should happen?

When you delete the currently selected site, Matomo should change the idSite parameter in the URL to a valid idSite so that measurable management works again.

How can this be reproduced?

Matomo version

5

PHP version

No response

Server operating system

No response

What browsers are you seeing the problem on?

No response

Computer operating system

No response

Relevant log output

No response

Validations

michalkleiner commented 11 hours ago

Hi Thomas, thanks for the report. Looking at the expected behaviour you're suggesting, would it possibly be better if parts of the admin interface that don't need to know about an active site didn't rely on having one in the URL at all? If we went with the approach of changing to a valid site id, which site id should it select? The oldest one, the newest one, the one with most revenue, some other one?

sgiehl commented 35 minutes ago

@michalkleiner Some parts of the admin do not need an idsite set. But if there is none, and you then switch to a part, where one would be needed, a similar problem occurs. So introducing some sort of default / fallback in case none is provided might be good.