-
-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.x] Prevent published toast when save failed #10191
[5.x] Prevent published toast when save failed #10191
Conversation
We're no longer accepting fixes to |
# Conflicts: # resources/lang/de.json # resources/lang/de_CH.json # resources/lang/fr.json # resources/lang/nl.json # src/Http/Controllers/CP/ActionController.php # src/Http/Controllers/CP/Collections/PublishedEntriesController.php
Ah, sorry, didn't think about that 🙈 The project this is relevant to is still on 4.x, hence the target. Looks like they've got another reason not to wait with the 5.x update 😁 I've re-targeted and merged 5.x, will see if more changes are required. |
@duncanmcclean done for now Still on the 4.x branch I already realised that the publish/unpublish actions also don't show any errors if saving fails. I've added a way of letting an action fail and optionally add a message that will be shown in the error toast. Additionally, I was not quite happy with the handling of the action modal. So far, if the action was not successful, the confirmation modal would still be shown and an error toast would pop up. This kind of suggests that something went technically wrong, as the interface is stuck – similar to when an ajax error occurres. I felt like it would be more appropriate if the modal closes, but the error toast doesn't just give you a generic "action failed" answer. To get there, I introduced a status information to the ActionController response, and adjusted the modal handling based on that status. Errors because of missing auth or something else still leave the modal open, while unsuccessful publish/unpublish actions close the modal and show an error toast. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still on the 4.x branch I already realised that the publish/unpublish actions also don't show any errors if saving fails. I've added a way of letting an action fail and optionally add a message that will be shown in the error toast.
Can you open a separate pull request with these changes, since they're unrelated to the original issue?
I've split up the changes into two new PRs:
|
fixes #10190
I've tried to stay as close as possible to the changes made in #9040 but needed some further adjustments. Specifically,
Revisable::publishWorkingCopy()
andRevisable::unpublishWorkingCopy()
now returnfalse
if the entrysave()
function fails. While this seems reasonable to me, I haven't yet found out if there are any other places (apart from the PublishedEntriesController) that would need to be considered.I have added translations for the "Couldn't (un)publish entry" toast message as far as my (non-german) language skills felt reliable enough.