DEV: Convert core components to native class syntax (batch 5) (#28597)
Changes made using the ember-native-class-codemod, plus some manual tweaks
This commit is contained in:
parent
935cbbb6a9
commit
77d4b3304e
|
@ -1,10 +1,13 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import {
|
||||||
|
attributeBindings,
|
||||||
|
classNameBindings,
|
||||||
|
} from "@ember-decorators/component";
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
|
|
||||||
export default Component.extend({
|
@classNameBindings(":featured-topic")
|
||||||
classNameBindings: [":featured-topic"],
|
@attributeBindings("topic.id:data-topic-id")
|
||||||
attributeBindings: ["topic.id:data-topic-id"],
|
export default class FeaturedTopic extends Component {
|
||||||
|
|
||||||
click(e) {
|
click(e) {
|
||||||
if (e.target.closest(".last-posted-at")) {
|
if (e.target.closest(".last-posted-at")) {
|
||||||
this.appEvents.trigger("topic-entrance:show", {
|
this.appEvents.trigger("topic-entrance:show", {
|
||||||
|
@ -13,5 +16,5 @@ export default Component.extend({
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<label class="radio checkbox-label">
|
<label class="radio checkbox-label">
|
||||||
<input
|
<input
|
||||||
id="radio_{{this.flag.name_key}}"
|
id="radio_{{this.flag.name_key}}"
|
||||||
{{on "click" (action "changePostActionType" this.flag)}}
|
{{on "click" (fn this.changePostActionType this.flag)}}
|
||||||
type="radio"
|
type="radio"
|
||||||
name="post_action_type_index"
|
name="post_action_type_index"
|
||||||
/>
|
/>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
<label class="radio checkbox-label">
|
<label class="radio checkbox-label">
|
||||||
<input
|
<input
|
||||||
id="radio_{{this.flag.name_key}}"
|
id="radio_{{this.flag.name_key}}"
|
||||||
{{on "click" (action "changePostActionType" this.flag)}}
|
{{on "click" (fn this.changePostActionType this.flag)}}
|
||||||
type="radio"
|
type="radio"
|
||||||
name="post_action_type_index"
|
name="post_action_type_index"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,23 +1,28 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { and, equal, not } from "@ember/object/computed";
|
import { and, equal, not } from "@ember/object/computed";
|
||||||
|
import { tagName } from "@ember-decorators/component";
|
||||||
import { MAX_MESSAGE_LENGTH } from "discourse/models/post-action-type";
|
import { MAX_MESSAGE_LENGTH } from "discourse/models/post-action-type";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
@tagName("")
|
||||||
tagName: "",
|
export default class FlagActionType extends Component {
|
||||||
|
@and("flag.require_message", "selected") showMessageInput;
|
||||||
|
@and("flag.isIllegal", "selected") showConfirmation;
|
||||||
|
@not("showMessageInput") showDescription;
|
||||||
|
@equal("flag.name_key", "notify_user") isNotifyUser;
|
||||||
|
|
||||||
@discourseComputed("flag.name_key")
|
@discourseComputed("flag.name_key")
|
||||||
wrapperClassNames(nameKey) {
|
wrapperClassNames(nameKey) {
|
||||||
return `flag-action-type ${nameKey}`;
|
return `flag-action-type ${nameKey}`;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("flag.name_key")
|
@discourseComputed("flag.name_key")
|
||||||
customPlaceholder(nameKey) {
|
customPlaceholder(nameKey) {
|
||||||
return I18n.t("flagging.custom_placeholder_" + nameKey, {
|
return I18n.t("flagging.custom_placeholder_" + nameKey, {
|
||||||
defaultValue: I18n.t("flagging.custom_placeholder_notify_moderators"),
|
defaultValue: I18n.t("flagging.custom_placeholder_notify_moderators"),
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("flag.name", "flag.name_key", "username")
|
@discourseComputed("flag.name", "flag.name_key", "username")
|
||||||
formattedName(name, nameKey, username) {
|
formattedName(name, nameKey, username) {
|
||||||
|
@ -28,29 +33,24 @@ export default Component.extend({
|
||||||
defaultValue: name,
|
defaultValue: name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("flag", "selectedFlag")
|
@discourseComputed("flag", "selectedFlag")
|
||||||
selected(flag, selectedFlag) {
|
selected(flag, selectedFlag) {
|
||||||
return flag === selectedFlag;
|
return flag === selectedFlag;
|
||||||
},
|
}
|
||||||
|
|
||||||
showMessageInput: and("flag.require_message", "selected"),
|
|
||||||
showConfirmation: and("flag.isIllegal", "selected"),
|
|
||||||
showDescription: not("showMessageInput"),
|
|
||||||
isNotifyUser: equal("flag.name_key", "notify_user"),
|
|
||||||
|
|
||||||
@discourseComputed("flag.description", "flag.short_description")
|
@discourseComputed("flag.description", "flag.short_description")
|
||||||
description(long_description, short_description) {
|
description(long_description, short_description) {
|
||||||
return this.site.mobileView ? short_description : long_description;
|
return this.site.mobileView ? short_description : long_description;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("message.length")
|
@discourseComputed("message.length")
|
||||||
customMessageLengthClasses(messageLength) {
|
customMessageLengthClasses(messageLength) {
|
||||||
return messageLength < this.siteSettings.min_personal_message_post_length
|
return messageLength < this.siteSettings.min_personal_message_post_length
|
||||||
? "too-short"
|
? "too-short"
|
||||||
: "ok";
|
: "ok";
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("message.length")
|
@discourseComputed("message.length")
|
||||||
customMessageLength(messageLength) {
|
customMessageLength(messageLength) {
|
||||||
|
@ -65,11 +65,5 @@ export default Component.extend({
|
||||||
count: MAX_MESSAGE_LENGTH - len,
|
count: MAX_MESSAGE_LENGTH - len,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
}
|
||||||
actions: {
|
|
||||||
changePostActionType(at) {
|
|
||||||
this.changePostActionType(at);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
import { observes } from "discourse-common/utils/decorators";
|
import { observes } from "@ember-decorators/object";
|
||||||
|
|
||||||
// Mostly hacks because `flag.hbs` didn't use `radio-button`
|
// Mostly hacks because `flag.hbs` didn't use `radio-button`
|
||||||
export default Component.extend({
|
export default class FlagSelection extends Component {
|
||||||
_selectRadio() {
|
_selectRadio() {
|
||||||
this.element.querySelector("input[type='radio']").checked = false;
|
this.element.querySelector("input[type='radio']").checked = false;
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@ export default Component.extend({
|
||||||
if (selector) {
|
if (selector) {
|
||||||
selector.checked = "true";
|
selector.checked = "true";
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@observes("nameKey")
|
@observes("nameKey")
|
||||||
selectedChanged() {
|
selectedChanged() {
|
||||||
next(this, this._selectRadio);
|
next(this, this._selectRadio);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,28 +1,32 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import {
|
||||||
|
attributeBindings,
|
||||||
|
classNames,
|
||||||
|
tagName,
|
||||||
|
} from "@ember-decorators/component";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
@tagName("button")
|
||||||
tagName: "button",
|
@classNames("btn-flat")
|
||||||
classNames: ["btn-flat"],
|
@attributeBindings("disabled", "translatedTitle:title")
|
||||||
attributeBindings: ["disabled", "translatedTitle:title"],
|
export default class FlatButton extends Component {
|
||||||
|
|
||||||
@discourseComputed("title")
|
@discourseComputed("title")
|
||||||
translatedTitle(title) {
|
translatedTitle(title) {
|
||||||
if (title) {
|
if (title) {
|
||||||
return I18n.t(title);
|
return I18n.t(title);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
keyDown(event) {
|
keyDown(event) {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
this.action?.();
|
this.action?.();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
click() {
|
click() {
|
||||||
this.action?.();
|
this.action?.();
|
||||||
return false;
|
return false;
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
export default Component.extend({
|
import { classNames } from "@ember-decorators/component";
|
||||||
classNames: ["footer-message"],
|
|
||||||
});
|
@classNames("footer-message")
|
||||||
|
export default class FooterMessage extends Component {}
|
||||||
|
|
|
@ -12,27 +12,28 @@ import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
import { FORMAT } from "select-kit/components/future-date-input-selector";
|
import { FORMAT } from "select-kit/components/future-date-input-selector";
|
||||||
|
|
||||||
export default Component.extend({
|
export default class FutureDateInput extends Component {
|
||||||
selection: null,
|
selection = null;
|
||||||
includeDateTime: true,
|
includeDateTime = true;
|
||||||
isCustom: equal("selection", "custom"),
|
|
||||||
displayDateAndTimePicker: and("includeDateTime", "isCustom"),
|
|
||||||
displayLabel: null,
|
|
||||||
labelClasses: null,
|
|
||||||
timeInputDisabled: empty("_date"),
|
|
||||||
userTimezone: null,
|
|
||||||
onChangeInput: null,
|
|
||||||
|
|
||||||
_date: null,
|
@equal("selection", "custom") isCustom;
|
||||||
_time: null,
|
@and("includeDateTime", "isCustom") displayDateAndTimePicker;
|
||||||
|
@empty("_date") timeInputDisabled;
|
||||||
|
|
||||||
|
displayLabel = null;
|
||||||
|
labelClasses = null;
|
||||||
|
userTimezone = null;
|
||||||
|
onChangeInput = null;
|
||||||
|
_date = null;
|
||||||
|
_time = null;
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
super.init(...arguments);
|
||||||
this.userTimezone = this.currentUser.user_option.timezone;
|
this.userTimezone = this.currentUser.user_option.timezone;
|
||||||
},
|
}
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this._super(...arguments);
|
super.didReceiveAttrs(...arguments);
|
||||||
|
|
||||||
if (this.label) {
|
if (this.label) {
|
||||||
this.set("displayLabel", I18n.t(this.label));
|
this.set("displayLabel", I18n.t(this.label));
|
||||||
|
@ -51,7 +52,7 @@ export default Component.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("customShortcuts")
|
@discourseComputed("customShortcuts")
|
||||||
shortcuts(customShortcuts) {
|
shortcuts(customShortcuts) {
|
||||||
|
@ -85,7 +86,7 @@ export default Component.extend({
|
||||||
icon: s.icon,
|
icon: s.icon,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
onChangeDate(date) {
|
onChangeDate(date) {
|
||||||
|
@ -94,14 +95,14 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
this._dateTimeChanged(date, this._time);
|
this._dateTimeChanged(date, this._time);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
onChangeTime(time) {
|
onChangeTime(time) {
|
||||||
if (this._date) {
|
if (this._date) {
|
||||||
this._dateTimeChanged(this._date, time);
|
this._dateTimeChanged(this._date, time);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
_dateTimeChanged(date, time) {
|
_dateTimeChanged(date, time) {
|
||||||
time = time ? ` ${time}` : "";
|
time = time ? ` ${time}` : "";
|
||||||
|
@ -112,7 +113,7 @@ export default Component.extend({
|
||||||
} else {
|
} else {
|
||||||
this.onChangeInput?.(null);
|
this.onChangeInput?.(null);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
_findClosestShortcut(dateTime) {
|
_findClosestShortcut(dateTime) {
|
||||||
return this.shortcuts.find((tf) => {
|
return this.shortcuts.find((tf) => {
|
||||||
|
@ -121,5 +122,5 @@ export default Component.extend({
|
||||||
return 0 <= diff && diff < 60 * 1000;
|
return 0 <= diff && diff < 60 * 1000;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -16,15 +16,15 @@ export function addGlobalNotice(text, id, options = {}) {
|
||||||
|
|
||||||
const GLOBAL_NOTICE_DISMISSED_PROMPT_KEY = "dismissed-global-notice-v2";
|
const GLOBAL_NOTICE_DISMISSED_PROMPT_KEY = "dismissed-global-notice-v2";
|
||||||
|
|
||||||
const Notice = EmberObject.extend({
|
class Notice extends EmberObject {
|
||||||
logsNoticeService: service("logsNotice"),
|
@service("logsNotice") logsNoticeService;
|
||||||
|
|
||||||
text: null,
|
text = null;
|
||||||
id: null,
|
id = null;
|
||||||
options: null,
|
options = null;
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
super.init(...arguments);
|
||||||
|
|
||||||
const defaults = {
|
const defaults = {
|
||||||
// can this banner be hidden
|
// can this banner be hidden
|
||||||
|
@ -47,8 +47,8 @@ const Notice = EmberObject.extend({
|
||||||
"options",
|
"options",
|
||||||
Object.assign(defaults, this.options || {})
|
Object.assign(defaults, this.options || {})
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
@tagName("")
|
@tagName("")
|
||||||
export default class GlobalNotice extends Component {
|
export default class GlobalNotice extends Component {
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias } from "@ember/object/computed";
|
||||||
|
import { classNameBindings, classNames } from "@ember-decorators/component";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default Component.extend({
|
@classNames("google-search-form")
|
||||||
classNames: ["google-search-form"],
|
@classNameBindings("hidden:hidden")
|
||||||
classNameBindings: ["hidden:hidden"],
|
export default class GoogleSearch extends Component {
|
||||||
|
@alias("siteSettings.login_required") hidden;
|
||||||
hidden: alias("siteSettings.login_required"),
|
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed
|
||||||
siteUrl() {
|
siteUrl() {
|
||||||
return `${location.protocol}//${location.host}${getURL("/")}`;
|
return `${location.protocol}//${location.host}${getURL("/")}`;
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import Component from "@ember/component";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { alias, gt } from "@ember/object/computed";
|
import { alias, gt } from "@ember/object/computed";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
|
import { classNameBindings, classNames } from "@ember-decorators/component";
|
||||||
import { setting } from "discourse/lib/computed";
|
import { setting } from "discourse/lib/computed";
|
||||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||||
import { groupPath } from "discourse/lib/url";
|
import { groupPath } from "discourse/lib/url";
|
||||||
|
@ -11,44 +12,49 @@ import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
const maxMembersToDisplay = 10;
|
const maxMembersToDisplay = 10;
|
||||||
|
|
||||||
export default Component.extend(CardContentsBase, CleansUp, {
|
@classNames("no-bg", "group-card")
|
||||||
composer: service(),
|
@classNameBindings(
|
||||||
|
"visible:show",
|
||||||
|
"showBadges",
|
||||||
|
"hasCardBadgeImage",
|
||||||
|
"isFixed:fixed",
|
||||||
|
"groupClass"
|
||||||
|
)
|
||||||
|
export default class GroupCardContents extends Component.extend(
|
||||||
|
CardContentsBase,
|
||||||
|
CleansUp
|
||||||
|
) {
|
||||||
|
@service composer;
|
||||||
|
@setting("allow_profile_backgrounds") allowBackgrounds;
|
||||||
|
@setting("enable_badges") showBadges;
|
||||||
|
|
||||||
elementId: "group-card",
|
@alias("topic.postStream") postStream;
|
||||||
mentionSelector: "a.mention-group",
|
@gt("moreMembersCount", 0) showMoreMembers;
|
||||||
classNames: ["no-bg", "group-card"],
|
|
||||||
classNameBindings: [
|
|
||||||
"visible:show",
|
|
||||||
"showBadges",
|
|
||||||
"hasCardBadgeImage",
|
|
||||||
"isFixed:fixed",
|
|
||||||
"groupClass",
|
|
||||||
],
|
|
||||||
allowBackgrounds: setting("allow_profile_backgrounds"),
|
|
||||||
showBadges: setting("enable_badges"),
|
|
||||||
|
|
||||||
postStream: alias("topic.postStream"),
|
elementId = "group-card";
|
||||||
showMoreMembers: gt("moreMembersCount", 0),
|
mentionSelector = "a.mention-group";
|
||||||
|
|
||||||
group: null,
|
group = null;
|
||||||
|
|
||||||
@discourseComputed("group.members.[]")
|
@discourseComputed("group.members.[]")
|
||||||
highlightedMembers(members) {
|
highlightedMembers(members) {
|
||||||
return members.slice(0, maxMembersToDisplay);
|
return members.slice(0, maxMembersToDisplay);
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("group.user_count", "group.members.[]")
|
@discourseComputed("group.user_count", "group.members.[]")
|
||||||
moreMembersCount(memberCount) {
|
moreMembersCount(memberCount) {
|
||||||
return Math.max(memberCount - maxMembersToDisplay, 0);
|
return Math.max(memberCount - maxMembersToDisplay, 0);
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("group.name")
|
@discourseComputed("group.name")
|
||||||
groupClass: (name) => (name ? `group-card-${name}` : ""),
|
groupClass(name) {
|
||||||
|
return name ? `group-card-${name}` : "";
|
||||||
|
}
|
||||||
|
|
||||||
@discourseComputed("group")
|
@discourseComputed("group")
|
||||||
groupPath(group) {
|
groupPath(group) {
|
||||||
return groupPath(group.name);
|
return groupPath(group.name);
|
||||||
},
|
}
|
||||||
|
|
||||||
async _showCallback(username) {
|
async _showCallback(username) {
|
||||||
this.setProperties({ visible: true, loading: true });
|
this.setProperties({ visible: true, loading: true });
|
||||||
|
@ -69,23 +75,23 @@ export default Component.extend(CardContentsBase, CleansUp, {
|
||||||
} finally {
|
} finally {
|
||||||
this.set("loading", null);
|
this.set("loading", null);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
_close() {
|
_close() {
|
||||||
this.set("group", null);
|
this.set("group", null);
|
||||||
|
|
||||||
this._super(...arguments);
|
super._close(...arguments);
|
||||||
},
|
}
|
||||||
|
|
||||||
cleanUp() {
|
cleanUp() {
|
||||||
this._close();
|
this._close();
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
close(event) {
|
close(event) {
|
||||||
event?.preventDefault();
|
event?.preventDefault();
|
||||||
this._close();
|
this._close();
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
handleShowGroup(event) {
|
handleShowGroup(event) {
|
||||||
|
@ -98,20 +104,20 @@ export default Component.extend(CardContentsBase, CleansUp, {
|
||||||
// refactoring this to a glimmer component.
|
// refactoring this to a glimmer component.
|
||||||
this.showGroup(this.group);
|
this.showGroup(this.group);
|
||||||
this._close();
|
this._close();
|
||||||
},
|
}
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
cancelFilter() {
|
cancelFilter() {
|
||||||
this.postStream.cancelFilter();
|
this.postStream.cancelFilter();
|
||||||
this.postStream.refresh();
|
this.postStream.refresh();
|
||||||
this._close();
|
this._close();
|
||||||
},
|
}
|
||||||
|
|
||||||
messageGroup() {
|
@action
|
||||||
this.composer.openNewMessage({
|
messageGroup() {
|
||||||
recipients: this.get("group.name"),
|
this.composer.openNewMessage({
|
||||||
hasGroups: true,
|
recipients: this.get("group.name"),
|
||||||
});
|
hasGroups: true,
|
||||||
},
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,33 +1,31 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { classNames } from "@ember-decorators/component";
|
||||||
|
import { observes, on } from "@ember-decorators/object";
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import discourseDebounce from "discourse-common/lib/debounce";
|
import discourseDebounce from "discourse-common/lib/debounce";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import { convertIconClass } from "discourse-common/lib/icon-library";
|
import { convertIconClass } from "discourse-common/lib/icon-library";
|
||||||
import discourseComputed, {
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
observes,
|
|
||||||
on,
|
|
||||||
} from "discourse-common/utils/decorators";
|
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
@classNames("group-flair-inputs")
|
||||||
classNames: ["group-flair-inputs"],
|
export default class GroupFlairInputs extends Component {
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed
|
||||||
demoAvatarUrl() {
|
demoAvatarUrl() {
|
||||||
return getURL("/images/avatar.png");
|
return getURL("/images/avatar.png");
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("model.flair_type")
|
@discourseComputed("model.flair_type")
|
||||||
flairPreviewIcon(flairType) {
|
flairPreviewIcon(flairType) {
|
||||||
return flairType && flairType === "icon";
|
return flairType && flairType === "icon";
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("model.flair_icon")
|
@discourseComputed("model.flair_icon")
|
||||||
flairPreviewIconUrl(flairIcon) {
|
flairPreviewIconUrl(flairIcon) {
|
||||||
return flairIcon ? convertIconClass(flairIcon) : "";
|
return flairIcon ? convertIconClass(flairIcon) : "";
|
||||||
},
|
}
|
||||||
|
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
@observes("model.flair_icon")
|
@observes("model.flair_icon")
|
||||||
|
@ -35,7 +33,7 @@ export default Component.extend({
|
||||||
if (flairIcon) {
|
if (flairIcon) {
|
||||||
discourseDebounce(this, this._loadIcon, 1000);
|
discourseDebounce(this, this._loadIcon, 1000);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
_loadIcon() {
|
_loadIcon() {
|
||||||
if (!this.model.flair_icon) {
|
if (!this.model.flair_icon) {
|
||||||
|
@ -62,23 +60,23 @@ export default Component.extend({
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("model.flair_type")
|
@discourseComputed("model.flair_type")
|
||||||
flairPreviewImage(flairType) {
|
flairPreviewImage(flairType) {
|
||||||
return flairType && flairType === "image";
|
return flairType && flairType === "image";
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("model.flair_url")
|
@discourseComputed("model.flair_url")
|
||||||
flairImageUrl(flairUrl) {
|
flairImageUrl(flairUrl) {
|
||||||
return flairUrl && flairUrl.includes("/") ? flairUrl : null;
|
return flairUrl && flairUrl.includes("/") ? flairUrl : null;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("flairPreviewImage")
|
@discourseComputed("flairPreviewImage")
|
||||||
flairPreviewLabel(flairPreviewImage) {
|
flairPreviewLabel(flairPreviewImage) {
|
||||||
const key = flairPreviewImage ? "image" : "icon";
|
const key = flairPreviewImage ? "image" : "icon";
|
||||||
return I18n.t(`groups.flair_preview_${key}`);
|
return I18n.t(`groups.flair_preview_${key}`);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
setFlairImage(upload) {
|
setFlairImage(upload) {
|
||||||
|
@ -86,7 +84,7 @@ export default Component.extend({
|
||||||
flair_url: getURL(upload.url),
|
flair_url: getURL(upload.url),
|
||||||
flair_upload_id: upload.id,
|
flair_upload_id: upload.id,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
removeFlairImage() {
|
removeFlairImage() {
|
||||||
|
@ -94,5 +92,5 @@ export default Component.extend({
|
||||||
flair_url: null,
|
flair_url: null,
|
||||||
flair_upload_id: null,
|
flair_upload_id: null,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import EmberObject, { action } from "@ember/object";
|
import EmberObject, { action } from "@ember/object";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
|
import { tagName } from "@ember-decorators/component";
|
||||||
|
import { on } from "@ember-decorators/object";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import emailProviderDefaultSettings from "discourse/lib/email-provider-default-settings";
|
import emailProviderDefaultSettings from "discourse/lib/email-provider-default-settings";
|
||||||
import discourseComputed, { on } from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default Component.extend({
|
@tagName("")
|
||||||
tagName: "",
|
export default class GroupImapEmailSettings extends Component {
|
||||||
form: null,
|
form = null;
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"group.email_username",
|
"group.email_username",
|
||||||
|
@ -20,7 +22,7 @@ export default Component.extend({
|
||||||
return [email_username, email_password, imap_server, imap_port].some(
|
return [email_username, email_password, imap_server, imap_port].some(
|
||||||
(value) => isEmpty(value)
|
(value) => isEmpty(value)
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("group.imap_mailboxes")
|
@discourseComputed("group.imap_mailboxes")
|
||||||
mailboxes(imapMailboxes) {
|
mailboxes(imapMailboxes) {
|
||||||
|
@ -28,17 +30,17 @@ export default Component.extend({
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return imapMailboxes.map((mailbox) => ({ name: mailbox, value: mailbox }));
|
return imapMailboxes.map((mailbox) => ({ name: mailbox, value: mailbox }));
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("group.imap_mailbox_name", "mailboxes.length")
|
@discourseComputed("group.imap_mailbox_name", "mailboxes.length")
|
||||||
mailboxSelected(mailboxName, mailboxesSize) {
|
mailboxSelected(mailboxName, mailboxesSize) {
|
||||||
return mailboxesSize === 0 || !isEmpty(mailboxName);
|
return mailboxesSize === 0 || !isEmpty(mailboxName);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
resetSettingsValid() {
|
resetSettingsValid() {
|
||||||
this.set("imapSettingsValid", false);
|
this.set("imapSettingsValid", false);
|
||||||
},
|
}
|
||||||
|
|
||||||
@on("init")
|
@on("init")
|
||||||
_fillForm() {
|
_fillForm() {
|
||||||
|
@ -50,13 +52,13 @@ export default Component.extend({
|
||||||
imap_ssl: this.group.imap_ssl,
|
imap_ssl: this.group.imap_ssl,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
prefillSettings(provider, event) {
|
prefillSettings(provider, event) {
|
||||||
event?.preventDefault();
|
event?.preventDefault();
|
||||||
this.form.setProperties(emailProviderDefaultSettings(provider, "imap"));
|
this.form.setProperties(emailProviderDefaultSettings(provider, "imap"));
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
testImapSettings() {
|
testImapSettings() {
|
||||||
|
@ -85,5 +87,5 @@ export default Component.extend({
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError)
|
.catch(popupAjaxError)
|
||||||
.finally(() => this.set("testingSettings", false));
|
.finally(() => this.set("testingSettings", false));
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,15 +2,17 @@ import Component from "@ember/component";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import discourseComputed, { on } from "discourse-common/utils/decorators";
|
import { tagName } from "@ember-decorators/component";
|
||||||
|
import { on } from "@ember-decorators/object";
|
||||||
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
@tagName("")
|
||||||
tagName: "",
|
export default class GroupManageEmailSettings extends Component {
|
||||||
dialog: service(),
|
@service dialog;
|
||||||
|
|
||||||
imapSettingsValid: false,
|
imapSettingsValid = false;
|
||||||
smtpSettingsValid: false,
|
smtpSettingsValid = false;
|
||||||
|
|
||||||
@on("init")
|
@on("init")
|
||||||
_determineSettingsValid() {
|
_determineSettingsValid() {
|
||||||
|
@ -22,7 +24,7 @@ export default Component.extend({
|
||||||
"smtpSettingsValid",
|
"smtpSettingsValid",
|
||||||
this.group.smtp_enabled && this.group.smtp_server
|
this.group.smtp_enabled && this.group.smtp_server
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"emailSettingsValid",
|
"emailSettingsValid",
|
||||||
|
@ -31,7 +33,7 @@ export default Component.extend({
|
||||||
)
|
)
|
||||||
enableImapSettings(emailSettingsValid, smtpEnabled, imapEnabled) {
|
enableImapSettings(emailSettingsValid, smtpEnabled, imapEnabled) {
|
||||||
return smtpEnabled && (emailSettingsValid || imapEnabled);
|
return smtpEnabled && (emailSettingsValid || imapEnabled);
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"smtpSettingsValid",
|
"smtpSettingsValid",
|
||||||
|
@ -48,7 +50,7 @@ export default Component.extend({
|
||||||
return (
|
return (
|
||||||
(!smtpEnabled || smtpSettingsValid) && (!imapEnabled || imapSettingsValid)
|
(!smtpEnabled || smtpSettingsValid) && (!imapEnabled || imapSettingsValid)
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
_anySmtpFieldsFilled() {
|
_anySmtpFieldsFilled() {
|
||||||
return [
|
return [
|
||||||
|
@ -57,18 +59,18 @@ export default Component.extend({
|
||||||
this.group.email_username,
|
this.group.email_username,
|
||||||
this.group.email_password,
|
this.group.email_password,
|
||||||
].some((value) => !isEmpty(value));
|
].some((value) => !isEmpty(value));
|
||||||
},
|
}
|
||||||
|
|
||||||
_anyImapFieldsFilled() {
|
_anyImapFieldsFilled() {
|
||||||
return [this.group.imap_server, this.group.imap_port].some(
|
return [this.group.imap_server, this.group.imap_port].some(
|
||||||
(value) => !isEmpty(value)
|
(value) => !isEmpty(value)
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
onChangeSmtpSettingsValid(valid) {
|
onChangeSmtpSettingsValid(valid) {
|
||||||
this.set("smtpSettingsValid", valid);
|
this.set("smtpSettingsValid", valid);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
smtpEnabledChange(event) {
|
smtpEnabledChange(event) {
|
||||||
|
@ -85,7 +87,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
this.group.set("smtp_enabled", event.target.checked);
|
this.group.set("smtp_enabled", event.target.checked);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
imapEnabledChange(event) {
|
imapEnabledChange(event) {
|
||||||
|
@ -101,7 +103,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
this.group.set("imap_enabled", event.target.checked);
|
this.group.set("imap_enabled", event.target.checked);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
afterSave() {
|
afterSave() {
|
||||||
|
@ -109,5 +111,5 @@ export default Component.extend({
|
||||||
this.store.find("group", this.group.name).then(() => {
|
this.store.find("group", this.group.name).then(() => {
|
||||||
this._determineSettingsValid();
|
this._determineSettingsValid();
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { tagName } from "@ember-decorators/component";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
@tagName("")
|
||||||
tagName: "",
|
export default class GroupManageLogsFilter extends Component {
|
||||||
|
|
||||||
@discourseComputed("type")
|
@discourseComputed("type")
|
||||||
label(type) {
|
label(type) {
|
||||||
return I18n.t(`groups.manage.logs.${type}`);
|
return I18n.t(`groups.manage.logs.${type}`);
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("value", "type")
|
@discourseComputed("value", "type")
|
||||||
filterText(value, type) {
|
filterText(value, type) {
|
||||||
return type === "action"
|
return type === "action"
|
||||||
? I18n.t(`group_histories.actions.${value}`)
|
? I18n.t(`group_histories.actions.${value}`)
|
||||||
: value;
|
: value;
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { tagName } from "@ember-decorators/component";
|
||||||
|
|
||||||
export default Component.extend({
|
@tagName("")
|
||||||
tagName: "",
|
export default class GroupManageLogsRow extends Component {
|
||||||
expandDetails: false,
|
expandDetails = false;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
toggleDetails() {
|
toggleDetails() {
|
||||||
this.toggleProperty("expandDetails");
|
this.toggleProperty("expandDetails");
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
filter(params) {
|
filter(params) {
|
||||||
this.set(`filters.${params.key}`, params.value);
|
this.set(`filters.${params.key}`, params.value);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -8,17 +8,19 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
export default class GroupManageSaveButton extends Component {
|
||||||
modal: service(),
|
@service modal;
|
||||||
saving: null,
|
|
||||||
disabled: false,
|
saving = null;
|
||||||
updateExistingUsers: null,
|
disabled = false;
|
||||||
hasFlair: or("model.flair_icon", "model.flair_upload_id"),
|
updateExistingUsers = null;
|
||||||
|
|
||||||
|
@or("model.flair_icon", "model.flair_upload_id") hasFlair;
|
||||||
|
|
||||||
@discourseComputed("saving")
|
@discourseComputed("saving")
|
||||||
savingText(saving) {
|
savingText(saving) {
|
||||||
return saving ? I18n.t("saving") : I18n.t("save");
|
return saving ? I18n.t("saving") : I18n.t("save");
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"model.visibility_level",
|
"model.visibility_level",
|
||||||
|
@ -39,12 +41,12 @@ export default Component.extend({
|
||||||
group_name: this.model.name,
|
group_name: this.model.name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
setUpdateExistingUsers(value) {
|
setUpdateExistingUsers(value) {
|
||||||
this.updateExistingUsers = value;
|
this.updateExistingUsers = value;
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
save() {
|
save() {
|
||||||
|
@ -86,7 +88,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => this.set("saving", false));
|
.finally(() => this.set("saving", false));
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async editGroupNotifications(json) {
|
async editGroupNotifications(json) {
|
||||||
|
@ -97,5 +99,5 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.save();
|
this.save();
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { classNames } from "@ember-decorators/component";
|
||||||
|
|
||||||
export default Component.extend({
|
@classNames("item")
|
||||||
classNames: ["item"],
|
export default class GroupMember extends Component {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
remove(event) {
|
remove(event) {
|
||||||
event?.preventDefault();
|
event?.preventDefault();
|
||||||
this.removeAction(this.member);
|
this.removeAction(this.member);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,42 +1,44 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { action } from "@ember/object";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
|
import { classNames } from "@ember-decorators/component";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import cookie from "discourse/lib/cookie";
|
import cookie from "discourse/lib/cookie";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
import RequestGroupMembershipForm from "./modal/request-group-membership-form";
|
import RequestGroupMembershipForm from "./modal/request-group-membership-form";
|
||||||
|
|
||||||
export default Component.extend({
|
@classNames("group-membership-button")
|
||||||
classNames: ["group-membership-button"],
|
export default class GroupMembershipButton extends Component {
|
||||||
appEvents: service(),
|
@service appEvents;
|
||||||
currentUser: service(),
|
@service currentUser;
|
||||||
dialog: service(),
|
@service dialog;
|
||||||
modal: service(),
|
@service modal;
|
||||||
|
|
||||||
@discourseComputed("model.public_admission", "userIsGroupUser")
|
@discourseComputed("model.public_admission", "userIsGroupUser")
|
||||||
canJoinGroup(publicAdmission, userIsGroupUser) {
|
canJoinGroup(publicAdmission, userIsGroupUser) {
|
||||||
return publicAdmission && !userIsGroupUser;
|
return publicAdmission && !userIsGroupUser;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("model.public_exit", "userIsGroupUser")
|
@discourseComputed("model.public_exit", "userIsGroupUser")
|
||||||
canLeaveGroup(publicExit, userIsGroupUser) {
|
canLeaveGroup(publicExit, userIsGroupUser) {
|
||||||
return publicExit && userIsGroupUser;
|
return publicExit && userIsGroupUser;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("model.allow_membership_requests", "userIsGroupUser")
|
@discourseComputed("model.allow_membership_requests", "userIsGroupUser")
|
||||||
canRequestMembership(allowMembershipRequests, userIsGroupUser) {
|
canRequestMembership(allowMembershipRequests, userIsGroupUser) {
|
||||||
return allowMembershipRequests && !userIsGroupUser;
|
return allowMembershipRequests && !userIsGroupUser;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("model.is_group_user")
|
@discourseComputed("model.is_group_user")
|
||||||
userIsGroupUser(isGroupUser) {
|
userIsGroupUser(isGroupUser) {
|
||||||
return !!isGroupUser;
|
return !!isGroupUser;
|
||||||
},
|
}
|
||||||
|
|
||||||
_showLoginModal() {
|
_showLoginModal() {
|
||||||
this.showLogin();
|
this.showLogin();
|
||||||
cookie("destination_url", window.location.href);
|
cookie("destination_url", window.location.href);
|
||||||
},
|
}
|
||||||
|
|
||||||
removeFromGroup() {
|
removeFromGroup() {
|
||||||
const model = this.model;
|
const model = this.model;
|
||||||
|
@ -48,53 +50,54 @@ export default Component.extend({
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError)
|
.catch(popupAjaxError)
|
||||||
.finally(() => this.set("updatingMembership", false));
|
.finally(() => this.set("updatingMembership", false));
|
||||||
},
|
}
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
joinGroup() {
|
joinGroup() {
|
||||||
if (this.currentUser) {
|
if (this.currentUser) {
|
||||||
this.set("updatingMembership", true);
|
|
||||||
const group = this.model;
|
|
||||||
|
|
||||||
group
|
|
||||||
.join()
|
|
||||||
.then(() => {
|
|
||||||
group.set("is_group_user", true);
|
|
||||||
this.appEvents.trigger("group:join", group);
|
|
||||||
})
|
|
||||||
.catch(popupAjaxError)
|
|
||||||
.finally(() => {
|
|
||||||
this.set("updatingMembership", false);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this._showLoginModal();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
leaveGroup() {
|
|
||||||
this.set("updatingMembership", true);
|
this.set("updatingMembership", true);
|
||||||
|
const group = this.model;
|
||||||
|
|
||||||
if (this.model.public_admission) {
|
group
|
||||||
this.removeFromGroup();
|
.join()
|
||||||
} else {
|
.then(() => {
|
||||||
return this.dialog.yesNoConfirm({
|
group.set("is_group_user", true);
|
||||||
message: I18n.t("groups.confirm_leave"),
|
this.appEvents.trigger("group:join", group);
|
||||||
didConfirm: () => this.removeFromGroup(),
|
})
|
||||||
didCancel: () => this.set("updatingMembership", false),
|
.catch(popupAjaxError)
|
||||||
|
.finally(() => {
|
||||||
|
this.set("updatingMembership", false);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
},
|
this._showLoginModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
showRequestMembershipForm() {
|
@action
|
||||||
if (this.currentUser) {
|
leaveGroup() {
|
||||||
this.modal.show(RequestGroupMembershipForm, {
|
this.set("updatingMembership", true);
|
||||||
model: {
|
|
||||||
group: this.model,
|
if (this.model.public_admission) {
|
||||||
},
|
this.removeFromGroup();
|
||||||
});
|
} else {
|
||||||
} else {
|
return this.dialog.yesNoConfirm({
|
||||||
this._showLoginModal();
|
message: I18n.t("groups.confirm_leave"),
|
||||||
}
|
didConfirm: () => this.removeFromGroup(),
|
||||||
},
|
didCancel: () => this.set("updatingMembership", false),
|
||||||
},
|
});
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
showRequestMembershipForm() {
|
||||||
|
if (this.currentUser) {
|
||||||
|
this.modal.show(RequestGroupMembershipForm, {
|
||||||
|
model: {
|
||||||
|
group: this.model,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this._showLoginModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
export default Component.extend({
|
import { tagName } from "@ember-decorators/component";
|
||||||
tagName: "",
|
|
||||||
});
|
@tagName("")
|
||||||
|
export default class GroupNavigation extends Component {}
|
||||||
|
|
|
@ -1,27 +1,26 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { propertyEqual } from "discourse/lib/computed";
|
import { equal } from "@ember/object/computed";
|
||||||
|
import { classNameBindings } from "@ember-decorators/component";
|
||||||
import { prioritizeNameInUx } from "discourse/lib/settings";
|
import { prioritizeNameInUx } from "discourse/lib/settings";
|
||||||
import { userPath } from "discourse/lib/url";
|
import { userPath } from "discourse/lib/url";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
@classNameBindings(
|
||||||
classNameBindings: [
|
":user-stream-item",
|
||||||
":user-stream-item",
|
":item",
|
||||||
":item",
|
"moderatorAction",
|
||||||
"moderatorAction",
|
"primaryGroup"
|
||||||
"primaryGroup",
|
)
|
||||||
],
|
export default class GroupPost extends Component {
|
||||||
|
@equal("post.post_type", "site.post_types.moderator_action")
|
||||||
|
moderatorAction;
|
||||||
|
|
||||||
@discourseComputed("post.url")
|
@discourseComputed("post.url")
|
||||||
postUrl(url) {
|
postUrl(url) {
|
||||||
return getURL(url);
|
return getURL(url);
|
||||||
},
|
}
|
||||||
moderatorAction: propertyEqual(
|
|
||||||
"post.post_type",
|
|
||||||
"site.post_types.moderator_action"
|
|
||||||
),
|
|
||||||
|
|
||||||
@discourseComputed("post.user")
|
@discourseComputed("post.user")
|
||||||
name(postUser) {
|
name(postUser) {
|
||||||
|
@ -29,22 +28,22 @@ export default Component.extend({
|
||||||
return postUser.name;
|
return postUser.name;
|
||||||
}
|
}
|
||||||
return postUser.username;
|
return postUser.username;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("post.user")
|
@discourseComputed("post.user")
|
||||||
primaryGroup(postUser) {
|
primaryGroup(postUser) {
|
||||||
if (postUser.primary_group_name) {
|
if (postUser.primary_group_name) {
|
||||||
return `group-${postUser.primary_group_name}`;
|
return `group-${postUser.primary_group_name}`;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("post.user.username")
|
@discourseComputed("post.user.username")
|
||||||
userUrl(username) {
|
userUrl(username) {
|
||||||
return userPath(username.toLowerCase());
|
return userPath(username.toLowerCase());
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("post.title", "post.post_number")
|
@discourseComputed("post.title", "post.post_number")
|
||||||
titleAriaLabel(title, postNumber) {
|
titleAriaLabel(title, postNumber) {
|
||||||
return I18n.t("groups.aria_post_number", { postNumber, title });
|
return I18n.t("groups.aria_post_number", { postNumber, title });
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,25 +1,23 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
|
import { observes, on } from "@ember-decorators/object";
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
import { findRawTemplate } from "discourse-common/lib/raw-templates";
|
import { findRawTemplate } from "discourse-common/lib/raw-templates";
|
||||||
import discourseComputed, {
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
observes,
|
|
||||||
on,
|
|
||||||
} from "discourse-common/utils/decorators";
|
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
export default class GroupSelector extends Component {
|
||||||
@discourseComputed("placeholderKey")
|
@discourseComputed("placeholderKey")
|
||||||
placeholder(placeholderKey) {
|
placeholder(placeholderKey) {
|
||||||
return placeholderKey ? I18n.t(placeholderKey) : "";
|
return placeholderKey ? I18n.t(placeholderKey) : "";
|
||||||
},
|
}
|
||||||
|
|
||||||
@observes("groupNames")
|
@observes("groupNames")
|
||||||
_update() {
|
_update() {
|
||||||
if (this.canReceiveUpdates === "true") {
|
if (this.canReceiveUpdates === "true") {
|
||||||
this._initializeAutocomplete({ updateData: true });
|
this._initializeAutocomplete({ updateData: true });
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
_initializeAutocomplete(opts) {
|
_initializeAutocomplete(opts) {
|
||||||
|
@ -62,5 +60,5 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
template: findRawTemplate("group-selector-autocomplete"),
|
template: findRawTemplate("group-selector-autocomplete"),
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -4,67 +4,54 @@ import { NotificationLevels } from "discourse/lib/notification-levels";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
export default class GroupsFormInteractionFields extends Component {
|
||||||
init() {
|
@or(
|
||||||
this._super(...arguments);
|
|
||||||
|
|
||||||
this.visibilityLevelOptions = [
|
|
||||||
{
|
|
||||||
name: I18n.t(
|
|
||||||
"admin.groups.manage.interaction.visibility_levels.public"
|
|
||||||
),
|
|
||||||
value: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t(
|
|
||||||
"admin.groups.manage.interaction.visibility_levels.logged_on_users"
|
|
||||||
),
|
|
||||||
value: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t(
|
|
||||||
"admin.groups.manage.interaction.visibility_levels.members"
|
|
||||||
),
|
|
||||||
value: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t("admin.groups.manage.interaction.visibility_levels.staff"),
|
|
||||||
value: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t(
|
|
||||||
"admin.groups.manage.interaction.visibility_levels.owners"
|
|
||||||
),
|
|
||||||
value: 4,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
this.aliasLevelOptions = [
|
|
||||||
{ name: I18n.t("groups.alias_levels.nobody"), value: 0 },
|
|
||||||
{ name: I18n.t("groups.alias_levels.only_admins"), value: 1 },
|
|
||||||
{ name: I18n.t("groups.alias_levels.mods_and_admins"), value: 2 },
|
|
||||||
{ name: I18n.t("groups.alias_levels.members_mods_and_admins"), value: 3 },
|
|
||||||
{ name: I18n.t("groups.alias_levels.owners_mods_and_admins"), value: 4 },
|
|
||||||
{ name: I18n.t("groups.alias_levels.everyone"), value: 99 },
|
|
||||||
];
|
|
||||||
|
|
||||||
this.watchingNotificationLevel = NotificationLevels.WATCHING;
|
|
||||||
},
|
|
||||||
|
|
||||||
membersVisibilityLevel: or(
|
|
||||||
"model.members_visibility_level",
|
"model.members_visibility_level",
|
||||||
"visibilityLevelOptions.firstObject.value"
|
"visibilityLevelOptions.firstObject.value"
|
||||||
),
|
)
|
||||||
|
membersVisibilityLevel;
|
||||||
|
|
||||||
messageableLevel: or(
|
@or("model.messageable_level", "aliasLevelOptions.firstObject.value")
|
||||||
"model.messageable_level",
|
messageableLevel;
|
||||||
"aliasLevelOptions.firstObject.value"
|
|
||||||
),
|
|
||||||
|
|
||||||
mentionableLevel: or(
|
@or("model.mentionable_level", "aliasLevelOptions.firstObject.value")
|
||||||
"model.mentionable_level",
|
mentionableLevel;
|
||||||
"aliasLevelOptions.firstObject.value"
|
|
||||||
),
|
visibilityLevelOptions = [
|
||||||
|
{
|
||||||
|
name: I18n.t("admin.groups.manage.interaction.visibility_levels.public"),
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: I18n.t(
|
||||||
|
"admin.groups.manage.interaction.visibility_levels.logged_on_users"
|
||||||
|
),
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: I18n.t("admin.groups.manage.interaction.visibility_levels.members"),
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: I18n.t("admin.groups.manage.interaction.visibility_levels.staff"),
|
||||||
|
value: 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: I18n.t("admin.groups.manage.interaction.visibility_levels.owners"),
|
||||||
|
value: 4,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
aliasLevelOptions = [
|
||||||
|
{ name: I18n.t("groups.alias_levels.nobody"), value: 0 },
|
||||||
|
{ name: I18n.t("groups.alias_levels.only_admins"), value: 1 },
|
||||||
|
{ name: I18n.t("groups.alias_levels.mods_and_admins"), value: 2 },
|
||||||
|
{ name: I18n.t("groups.alias_levels.members_mods_and_admins"), value: 3 },
|
||||||
|
{ name: I18n.t("groups.alias_levels.owners_mods_and_admins"), value: 4 },
|
||||||
|
{ name: I18n.t("groups.alias_levels.everyone"), value: 99 },
|
||||||
|
];
|
||||||
|
|
||||||
|
watchingNotificationLevel = NotificationLevels.WATCHING;
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"model.default_notification_level",
|
"model.default_notification_level",
|
||||||
|
@ -78,7 +65,7 @@ export default Component.extend({
|
||||||
return defaultNotificationLevel;
|
return defaultNotificationLevel;
|
||||||
}
|
}
|
||||||
return watchingNotificationLevel;
|
return watchingNotificationLevel;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"siteSettings.email_in",
|
"siteSettings.email_in",
|
||||||
|
@ -87,7 +74,7 @@ export default Component.extend({
|
||||||
)
|
)
|
||||||
showEmailSettings(emailIn, automatic, isAdmin) {
|
showEmailSettings(emailIn, automatic, isAdmin) {
|
||||||
return emailIn && isAdmin && !automatic;
|
return emailIn && isAdmin && !automatic;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"model.isCreated",
|
"model.isCreated",
|
||||||
|
@ -96,12 +83,12 @@ export default Component.extend({
|
||||||
)
|
)
|
||||||
canAdminGroup(isCreated, canAdmin, canCreate) {
|
canAdminGroup(isCreated, canAdmin, canCreate) {
|
||||||
return (!isCreated && canCreate) || (isCreated && canAdmin);
|
return (!isCreated && canCreate) || (isCreated && canAdmin);
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed("membersVisibilityLevel")
|
@discourseComputed("membersVisibilityLevel")
|
||||||
membersVisibilityPrivate(membersVisibilityLevel) {
|
membersVisibilityPrivate(membersVisibilityLevel) {
|
||||||
return (
|
return (
|
||||||
membersVisibilityLevel !== this.visibilityLevelOptions.firstObject.value
|
membersVisibilityLevel !== this.visibilityLevelOptions.firstObject.value
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,51 +1,48 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { computed } from "@ember/object";
|
import { action, computed } from "@ember/object";
|
||||||
import { not, readOnly } from "@ember/object/computed";
|
import { not, readOnly } from "@ember/object/computed";
|
||||||
import AssociatedGroup from "discourse/models/associated-group";
|
import AssociatedGroup from "discourse/models/associated-group";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
export default class GroupsFormMembershipFields extends Component {
|
||||||
tokenSeparator: "|",
|
tokenSeparator = "|";
|
||||||
showAssociatedGroups: readOnly("site.can_associate_groups"),
|
|
||||||
|
@readOnly("site.can_associate_groups") showAssociatedGroups;
|
||||||
|
@not("model.automatic") canEdit;
|
||||||
|
|
||||||
|
trustLevelOptions = [
|
||||||
|
{
|
||||||
|
name: I18n.t("admin.groups.manage.membership.trust_levels_none"),
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{ name: 1, value: 1 },
|
||||||
|
{ name: 2, value: 2 },
|
||||||
|
{ name: 3, value: 3 },
|
||||||
|
{ name: 4, value: 4 },
|
||||||
|
];
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
super.init(...arguments);
|
||||||
|
|
||||||
this.set("trustLevelOptions", [
|
|
||||||
{
|
|
||||||
name: I18n.t("admin.groups.manage.membership.trust_levels_none"),
|
|
||||||
value: 0,
|
|
||||||
},
|
|
||||||
{ name: 1, value: 1 },
|
|
||||||
{ name: 2, value: 2 },
|
|
||||||
{ name: 3, value: 3 },
|
|
||||||
{ name: 4, value: 4 },
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (this.showAssociatedGroups) {
|
if (this.showAssociatedGroups) {
|
||||||
this.loadAssociatedGroups();
|
this.loadAssociatedGroups();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
canEdit: not("model.automatic"),
|
@computed("model.grant_trust_level", "trustLevelOptions")
|
||||||
|
get groupTrustLevel() {
|
||||||
groupTrustLevel: computed(
|
return (
|
||||||
"model.grant_trust_level",
|
this.model.get("grant_trust_level") ||
|
||||||
"trustLevelOptions",
|
this.trustLevelOptions.firstObject.value
|
||||||
function () {
|
);
|
||||||
return (
|
}
|
||||||
this.model.get("grant_trust_level") ||
|
|
||||||
this.trustLevelOptions.firstObject.value
|
|
||||||
);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
@discourseComputed("model.visibility_level", "model.public_admission")
|
@discourseComputed("model.visibility_level", "model.public_admission")
|
||||||
disableMembershipRequestSetting(visibility_level, publicAdmission) {
|
disableMembershipRequestSetting(visibility_level, publicAdmission) {
|
||||||
visibility_level = parseInt(visibility_level, 10);
|
visibility_level = parseInt(visibility_level, 10);
|
||||||
return publicAdmission || visibility_level > 1;
|
return publicAdmission || visibility_level > 1;
|
||||||
},
|
}
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"model.visibility_level",
|
"model.visibility_level",
|
||||||
|
@ -54,22 +51,22 @@ export default Component.extend({
|
||||||
disablePublicSetting(visibility_level, allowMembershipRequests) {
|
disablePublicSetting(visibility_level, allowMembershipRequests) {
|
||||||
visibility_level = parseInt(visibility_level, 10);
|
visibility_level = parseInt(visibility_level, 10);
|
||||||
return allowMembershipRequests || visibility_level > 1;
|
return allowMembershipRequests || visibility_level > 1;
|
||||||
},
|
}
|
||||||
|
|
||||||
emailDomains: computed("model.emailDomains", function () {
|
@computed("model.emailDomains")
|
||||||
|
get emailDomains() {
|
||||||
return this.model.emailDomains.split(this.tokenSeparator).filter(Boolean);
|
return this.model.emailDomains.split(this.tokenSeparator).filter(Boolean);
|
||||||
}),
|
}
|
||||||
|
|
||||||
loadAssociatedGroups() {
|
loadAssociatedGroups() {
|
||||||
AssociatedGroup.list().then((ags) => this.set("associatedGroups", ags));
|
AssociatedGroup.list().then((ags) => this.set("associatedGroups", ags));
|
||||||
},
|
}
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
onChangeEmailDomainsSetting(value) {
|
onChangeEmailDomainsSetting(value) {
|
||||||
this.set(
|
this.set(
|
||||||
"model.automatic_membership_email_domains",
|
"model.automatic_membership_email_domains",
|
||||||
value.join(this.tokenSeparator)
|
value.join(this.tokenSeparator)
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
|
||||||
|
|
|
@ -2,18 +2,21 @@ import Component from "@ember/component";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { not } from "@ember/object/computed";
|
import { not } from "@ember/object/computed";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
|
import { observes } from "@ember-decorators/object";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import Group from "discourse/models/group";
|
import Group from "discourse/models/group";
|
||||||
import discourseDebounce from "discourse-common/lib/debounce";
|
import discourseDebounce from "discourse-common/lib/debounce";
|
||||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default Component.extend({
|
export default class GroupsFormProfileFields extends Component {
|
||||||
disableSave: null,
|
disableSave = null;
|
||||||
nameInput: null,
|
nameInput = null;
|
||||||
|
|
||||||
|
@not("model.automatic") canEdit;
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
super.didInsertElement(...arguments);
|
||||||
const name = this.get("model.name");
|
const name = this.get("model.name");
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
|
@ -21,14 +24,12 @@ export default Component.extend({
|
||||||
} else {
|
} else {
|
||||||
this.set("disableSave", true);
|
this.set("disableSave", true);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
canEdit: not("model.automatic"),
|
|
||||||
|
|
||||||
@discourseComputed("basicNameValidation", "uniqueNameValidation")
|
@discourseComputed("basicNameValidation", "uniqueNameValidation")
|
||||||
nameValidation(basicNameValidation, uniqueNameValidation) {
|
nameValidation(basicNameValidation, uniqueNameValidation) {
|
||||||
return uniqueNameValidation ? uniqueNameValidation : basicNameValidation;
|
return uniqueNameValidation ? uniqueNameValidation : basicNameValidation;
|
||||||
},
|
}
|
||||||
|
|
||||||
@observes("nameInput")
|
@observes("nameInput")
|
||||||
_validateName() {
|
_validateName() {
|
||||||
|
@ -62,11 +63,11 @@ export default Component.extend({
|
||||||
return this._failedInputValidation(
|
return this._failedInputValidation(
|
||||||
I18n.t("admin.groups.new.name.checking")
|
I18n.t("admin.groups.new.name.checking")
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
checkGroupNameDebounced() {
|
checkGroupNameDebounced() {
|
||||||
discourseDebounce(this, this._checkGroupName, 500);
|
discourseDebounce(this, this._checkGroupName, 500);
|
||||||
},
|
}
|
||||||
|
|
||||||
_checkGroupName() {
|
_checkGroupName() {
|
||||||
if (isEmpty(this.nameInput)) {
|
if (isEmpty(this.nameInput)) {
|
||||||
|
@ -101,7 +102,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
},
|
}
|
||||||
|
|
||||||
_failedInputValidation(reason) {
|
_failedInputValidation(reason) {
|
||||||
this.set("disableSave", true);
|
this.set("disableSave", true);
|
||||||
|
@ -111,5 +112,5 @@ export default Component.extend({
|
||||||
options.reason = reason;
|
options.reason = reason;
|
||||||
}
|
}
|
||||||
this.set("basicNameValidation", EmberObject.create(options));
|
this.set("basicNameValidation", EmberObject.create(options));
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
Loading…
Reference in New Issue