Show a toast when a milestone is deleted
What does this MR do and why?
Shows a "Milestone deleted." toast after a milestone is deleted, from either the milestones list or a milestone detail page, for both project and group milestones. Today the user gets no success feedback; the milestone just disappears from the list.
Root cause of the missing feedback being non-trivial: the delete modal removes the milestone with an XHR (axios.delete) and the browser transparently follows the controller's HTML redirect. That intermediate response renders the full milestones index, which consumes any flash message, and the page the user actually sees is a second, fresh fetch of the same URL (visitUrl(response.request.responseURL)). A plain flash[:toast] in the destroy action would never survive to the user.
The fix:
- Both destroy actions set
flash[:toast]and gain aformat.jsonresponse returning the milestones index asredirect_url. - The delete modal requests JSON and navigates to the returned URL. Nothing renders in between, so the flash survives and the layout's existing toast mechanism (
.js-toast-message) shows it on arrival. - Side benefit: the milestones index is now fetched once instead of twice per deletion.
- The legacy
format.js { head :ok }responses are removed from both destroy actions: nothing requests them (the Vue modal replaced the UJS flow; noremote: truemilestone links or script-format callers exist in app code or specs). Removing them is also what makes setting the flash once aboverespond_tosafe; with the js format kept, ahead :okresponse would leave a stale toast that pops on the user's next page load.
Consumer audit: delete_milestone_modal.vue (used by more_actions_dropdown.vue on both list and detail pages) is the only caller of the XHR flow; EE extends only search_params on the group controller, not destroy.
The end-to-end behavior (modal, JSON delete, navigation, toast rendered) is covered by spec/features/milestones/user_deletes_milestone_spec.rb in both project and group contexts, plus html/json controller examples and the component spec.
References
- Show confirmation toast on milestone deletion (#477255), which sets the toast copy in its acceptance criteria.
Screenshots or screen recordings
| View | Before | After |
|---|---|---|
| Project milestones | ![]() |
![]() |
| Group milestones | ![]() |
![]() |
How to set up and validate locally
- In any project or group, create a milestone (Plan > Milestones > New milestone).
- From the milestones list or the milestone's page, open Milestone actions and select Delete, then confirm with Delete milestone.
- After redirect to the milestones list, a "Milestone deleted." toast appears bottom-left.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.



