Skip to content

A platform for community discussion. Free, open, simple.

FIX: saved indicator showing on failed save in chat preferences (#37792)

Sam79395cdc29c6
diff --git a/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.gjs b/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.gjs
index e12b5d91bf0..802821a069c 100644
--- a/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.gjs
+++ b/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.gjs
@@ -143,6 +143,8 @@ export default class Chat extends Component {
@action
handleSubmit(data) {
+ this.saved = false;
+
const { chat_quick_reactions_custom, ...userOptions } = data;
const shouldReload =
userOptions.chat_enabled !== this.args.model.user_option.chat_enabled;
@@ -158,14 +160,12 @@ export default class Chat extends Component {
return this.args.model
.save(CHAT_ATTRS)
.then(() => {
+ this.saved = true;
if (shouldReload && !isTesting()) {
location.reload();
}
})
- .catch(popupAjaxError)
- .finally(() => {
- this.saved = true;
- });
+ .catch(popupAjaxError);
}
<template>