BrandanBurgess opened a new pull request, #45753: URL: https://github.com/apache/superset/pull/45753
### SUMMARY When a user tries to set up an email report for a chart or dashboard they are already subscribed to, `POST /api/v1/report/subscribe` returns `409 Resource already has an attached report.` The report modal treated that like any other failure: a "Failed to create report" toast plus an error alert, leaving the user to find their existing subscription on the Alerts & Reports page. This usually happens when the header menu is out of date, e.g. the subscription was created in another tab, so the menu still offers "Set up an email report" instead of "Manage email report". With this change, a 409 on the subscribe path: - no longer raises the "Failed to create report" danger toast in `subscribeReport` - re-fetches the user's report for that chart or dashboard (the same `fetchUISpecificReport` lookup the header dropdown uses), which puts it in the Redux store, so the modal switches to edit mode with the existing report's settings and the header menu updates to "Manage email report" - shows an info toast explaining that the existing report was opened for editing If the existing report can't be found (for example, the lookup fails), the modal falls back to the current error behaviour. No backend change is needed: the 409 is already returned and covered by `tests/integration_tests/reports/api_tests.py`. Based on the discussion in #42922. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Before: "Failed to create report" toast and error alert in the modal. After: the modal reopens as "Edit email report" with the existing subscription loaded, plus an info toast. ### TESTING INSTRUCTIONS 1. Enable `ALERT_REPORTS` and open a dashboard in two tabs. 2. In tab 1, choose "Set up an email report" and save. 3. In tab 2 (menu still shows "Set up an email report"), set one up again and click Add. 4. The modal switches to "Edit email report" with the existing report's settings, an info toast explains why, and no failure toast is shown. Unit tests: `npm run test -- src/features/reports/ReportModal` - `duplicate subscription opens the existing report for editing` - `duplicate subscription shows the error when the existing report cannot be found` ### ADDITIONAL INFORMATION - [x] Has associated issue: #42922 (discussion) - [x] Required feature flags: `ALERT_REPORTS` - [x] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
