This repository has been archived on 2023-03-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
osr-discourse-src/app/assets/javascripts/discourse/components/group-manage-save-button.js
T

35 lines
862 B
JavaScript

import discourseComputed from "discourse-common/utils/decorators";
import Component from "@ember/component";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { popupAutomaticMembershipAlert } from "discourse/controllers/groups-new";
export default Component.extend({
saving: null,
@discourseComputed("saving")
savingText(saving) {
if (saving) return I18n.t("saving");
return saving ? I18n.t("saving") : I18n.t("save");
},
actions: {
save() {
this.set("saving", true);
const group = this.model;
popupAutomaticMembershipAlert(
group.id,
group.automatic_membership_email_domains
);
return group
.save()
.then(() => {
this.set("saved", true);
})
.catch(popupAjaxError)
.finally(() => this.set("saving", false));
}
}
});