Repository navigation
Answer a missing alert with 404 and another user's alert with 403 - #303
Merged
Merged
Conversation
…tead of 500 Delete and save show the message of a 4xx in a toast, since AjaxHelper only shows its generic error for one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
CustomAlerts now answers a request for an alert that does not exist with HTTP 404, and a request for another user's alert with HTTP 403, instead of HTTP 200 with an error result. This covers
getAlert,editAlert,deleteAlertandgetValuesForAlertInPast. The alert edit page and the internalformatAlertscontroller action, which answered a server error (HTTP 500), now answer with the same 404 or 403.Deleting or saving an alert that was deleted in another tab still shows its message, in a toast, because Matomo's UI only shows a generic error for a 4xx response. Validation errors when saving an alert are unchanged.
Issue No
N/A, follow-up to core's switch to HTTP 4xx exceptions for client errors.
Steps to Replicate the Issue
index.php?module=API&method=CustomAlerts.getAlert&idAlert=99999&format=jsonwith a validtoken_auth.Checklist