UX: Show error when checkbox change fails (#27968)

e.g. due to a permissions/network issue
This commit is contained in:
David Taylor 2024-07-18 13:22:10 +01:00 committed by GitHub
parent 1aa24f83bb
commit 94d4b187ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { withPluginApi } from "discourse/lib/plugin-api";
import { iconHTML } from "discourse-common/lib/icon-library";
import I18n from "discourse-i18n";
@ -154,6 +155,8 @@ export function checklistSyntax(elem, postDecorator) {
postWidget.attrs.isSaving = false;
postWidget.scheduleRerender();
} catch (e) {
popupAjaxError(e);
} finally {
boxes.forEach((e) => e.classList.remove("readonly"));
box.classList.remove("hidden");