mirror of
https://github.com/discourse/discourse.git
synced 2025-01-22 11:58:30 +08:00
DEV: Move computed to discourseComputed (#8312)
This commit is contained in:
parent
d74546f50e
commit
6275c05c0d
|
@ -1,6 +1,6 @@
|
|||
import Component from "@ember/component";
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export default Component.extend({
|
||||
|
|
|
@ -4,7 +4,7 @@ import debounce from "discourse/lib/debounce";
|
|||
import { renderSpinner } from "discourse/helpers/loading-spinner";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
import { observes, on } from "ember-addons/ember-computed-decorators";
|
||||
import { observes, on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend(
|
||||
bufferedRender({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["admin-report-storage-stats"],
|
||||
|
@ -10,32 +10,32 @@ export default Component.extend({
|
|||
backupStats: alias("model.data.backups"),
|
||||
uploadStats: alias("model.data.uploads"),
|
||||
|
||||
@computed("backupStats")
|
||||
@discourseComputed("backupStats")
|
||||
showBackupStats(stats) {
|
||||
return stats && this.currentUser.admin;
|
||||
},
|
||||
|
||||
@computed("backupLocation")
|
||||
@discourseComputed("backupLocation")
|
||||
backupLocationName(backupLocation) {
|
||||
return I18n.t(`admin.backups.location.${backupLocation}`);
|
||||
},
|
||||
|
||||
@computed("backupStats.used_bytes")
|
||||
@discourseComputed("backupStats.used_bytes")
|
||||
usedBackupSpace(bytes) {
|
||||
return I18n.toHumanSize(bytes);
|
||||
},
|
||||
|
||||
@computed("backupStats.free_bytes")
|
||||
@discourseComputed("backupStats.free_bytes")
|
||||
freeBackupSpace(bytes) {
|
||||
return I18n.toHumanSize(bytes);
|
||||
},
|
||||
|
||||
@computed("uploadStats.used_bytes")
|
||||
@discourseComputed("uploadStats.used_bytes")
|
||||
usedUploadSpace(bytes) {
|
||||
return I18n.toHumanSize(bytes);
|
||||
},
|
||||
|
||||
@computed("uploadStats.free_bytes")
|
||||
@discourseComputed("uploadStats.free_bytes")
|
||||
freeUploadSpace(bytes) {
|
||||
return I18n.toHumanSize(bytes);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "td",
|
||||
|
@ -8,7 +8,7 @@ export default Component.extend({
|
|||
classNameBindings: ["type", "property"],
|
||||
options: null,
|
||||
|
||||
@computed("label", "data", "options")
|
||||
@discourseComputed("label", "data", "options")
|
||||
computedLabel(label, data, options) {
|
||||
return label.compute(data, options || {});
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "th",
|
||||
|
@ -7,12 +7,12 @@ export default Component.extend({
|
|||
classNameBindings: ["label.mainProperty", "label.type", "isCurrentSort"],
|
||||
attributeBindings: ["label.title:title"],
|
||||
|
||||
@computed("currentSortLabel.sortProperty", "label.sortProperty")
|
||||
@discourseComputed("currentSortLabel.sortProperty", "label.sortProperty")
|
||||
isCurrentSort(currentSortField, labelSortField) {
|
||||
return currentSortField === labelSortField;
|
||||
},
|
||||
|
||||
@computed("currentSortDirection")
|
||||
@discourseComputed("currentSortDirection")
|
||||
sortIcon(currentSortDirection) {
|
||||
return currentSortDirection === 1 ? "caret-up" : "caret-down";
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const PAGES_LIMIT = 8;
|
||||
|
||||
|
@ -13,12 +13,16 @@ export default Component.extend({
|
|||
perPage: alias("options.perPage"),
|
||||
page: 0,
|
||||
|
||||
@computed("model.computedLabels.length")
|
||||
@discourseComputed("model.computedLabels.length")
|
||||
twoColumns(labelsLength) {
|
||||
return labelsLength === 2;
|
||||
},
|
||||
|
||||
@computed("totalsForSample", "options.total", "model.dates_filtering")
|
||||
@discourseComputed(
|
||||
"totalsForSample",
|
||||
"options.total",
|
||||
"model.dates_filtering"
|
||||
)
|
||||
showTotalForSample(totalsForSample, total, datesFiltering) {
|
||||
// check if we have at least one cell which contains a value
|
||||
const sum = totalsForSample
|
||||
|
@ -29,12 +33,16 @@ export default Component.extend({
|
|||
return sum >= 1 && total && datesFiltering;
|
||||
},
|
||||
|
||||
@computed("model.total", "options.total", "twoColumns")
|
||||
@discourseComputed("model.total", "options.total", "twoColumns")
|
||||
showTotal(reportTotal, total, twoColumns) {
|
||||
return reportTotal && total && twoColumns;
|
||||
},
|
||||
|
||||
@computed("model.{average,data}", "totalsForSample.1.value", "twoColumns")
|
||||
@discourseComputed(
|
||||
"model.{average,data}",
|
||||
"totalsForSample.1.value",
|
||||
"twoColumns"
|
||||
)
|
||||
showAverage(model, sampleTotalValue, hasTwoColumns) {
|
||||
return (
|
||||
model.average &&
|
||||
|
@ -44,17 +52,17 @@ export default Component.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@computed("totalsForSample.1.value", "model.data.length")
|
||||
@discourseComputed("totalsForSample.1.value", "model.data.length")
|
||||
averageForSample(totals, count) {
|
||||
return (totals / count).toFixed(0);
|
||||
},
|
||||
|
||||
@computed("model.data.length")
|
||||
@discourseComputed("model.data.length")
|
||||
showSortingUI(dataLength) {
|
||||
return dataLength >= 5;
|
||||
},
|
||||
|
||||
@computed("totalsForSampleRow", "model.computedLabels")
|
||||
@discourseComputed("totalsForSampleRow", "model.computedLabels")
|
||||
totalsForSample(row, labels) {
|
||||
return labels.map(label => {
|
||||
const computedLabel = label.compute(row);
|
||||
|
@ -64,7 +72,7 @@ export default Component.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@computed("model.data", "model.computedLabels")
|
||||
@discourseComputed("model.data", "model.computedLabels")
|
||||
totalsForSampleRow(rows, labels) {
|
||||
if (!rows || !rows.length) return {};
|
||||
|
||||
|
@ -90,7 +98,7 @@ export default Component.extend({
|
|||
return totalsRow;
|
||||
},
|
||||
|
||||
@computed("sortLabel", "sortDirection", "model.data.[]")
|
||||
@discourseComputed("sortLabel", "sortDirection", "model.data.[]")
|
||||
sortedData(sortLabel, sortDirection, data) {
|
||||
data = makeArray(data);
|
||||
|
||||
|
@ -110,7 +118,7 @@ export default Component.extend({
|
|||
return data;
|
||||
},
|
||||
|
||||
@computed("sortedData.[]", "perPage", "page")
|
||||
@discourseComputed("sortedData.[]", "perPage", "page")
|
||||
paginatedData(data, perPage, page) {
|
||||
if (perPage < data.length) {
|
||||
const start = perPage * page;
|
||||
|
@ -120,7 +128,7 @@ export default Component.extend({
|
|||
return data;
|
||||
},
|
||||
|
||||
@computed("model.data", "perPage", "page")
|
||||
@discourseComputed("model.data", "perPage", "page")
|
||||
pages(data, perPage, page) {
|
||||
if (!data || data.length <= perPage) return [];
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { alias, or, and, reads, equal, notEmpty } from "@ember/object/computed";
|
||||
import EmberObject from "@ember/object";
|
||||
|
@ -8,7 +9,6 @@ import { exportEntity } from "discourse/lib/export-csv";
|
|||
import { outputExportResult } from "discourse/lib/export-result";
|
||||
import { isNumeric } from "discourse/lib/utilities";
|
||||
import { SCHEMA_VERSION, default as Report } from "admin/models/report";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import ENV from "discourse-common/config/environment";
|
||||
|
||||
const TABLE_OPTIONS = {
|
||||
|
@ -90,23 +90,23 @@ export default Component.extend({
|
|||
|
||||
hasData: notEmpty("model.data"),
|
||||
|
||||
@computed("dataSourceName", "model.type")
|
||||
@discourseComputed("dataSourceName", "model.type")
|
||||
dasherizedDataSourceName(dataSourceName, type) {
|
||||
return (dataSourceName || type || "undefined").replace(/_/g, "-");
|
||||
},
|
||||
|
||||
@computed("dataSourceName", "model.type")
|
||||
@discourseComputed("dataSourceName", "model.type")
|
||||
dataSource(dataSourceName, type) {
|
||||
dataSourceName = dataSourceName || type;
|
||||
return `/admin/reports/${dataSourceName}`;
|
||||
},
|
||||
|
||||
@computed("displayedModes.length")
|
||||
@discourseComputed("displayedModes.length")
|
||||
showModes(displayedModesLength) {
|
||||
return displayedModesLength > 1;
|
||||
},
|
||||
|
||||
@computed("currentMode", "model.modes", "forcedModes")
|
||||
@discourseComputed("currentMode", "model.modes", "forcedModes")
|
||||
displayedModes(currentMode, reportModes, forcedModes) {
|
||||
const modes = forcedModes ? forcedModes.split(",") : reportModes;
|
||||
|
||||
|
@ -122,12 +122,12 @@ export default Component.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@computed("currentMode")
|
||||
@discourseComputed("currentMode")
|
||||
modeComponent(currentMode) {
|
||||
return `admin-report-${currentMode}`;
|
||||
},
|
||||
|
||||
@computed("startDate")
|
||||
@discourseComputed("startDate")
|
||||
normalizedStartDate(startDate) {
|
||||
return startDate && typeof startDate.isValid === "function"
|
||||
? moment
|
||||
|
@ -139,7 +139,7 @@ export default Component.extend({
|
|||
.format("YYYYMMDD");
|
||||
},
|
||||
|
||||
@computed("endDate")
|
||||
@discourseComputed("endDate")
|
||||
normalizedEndDate(endDate) {
|
||||
return endDate && typeof endDate.isValid === "function"
|
||||
? moment
|
||||
|
@ -151,7 +151,7 @@ export default Component.extend({
|
|||
.format("YYYYMMDD");
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"dataSourceName",
|
||||
"normalizedStartDate",
|
||||
"normalizedEndDate",
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
|
||||
export default Component.extend({
|
||||
@computed("theme.targets", "onlyOverridden", "showAdvanced")
|
||||
@discourseComputed("theme.targets", "onlyOverridden", "showAdvanced")
|
||||
visibleTargets(targets, onlyOverridden, showAdvanced) {
|
||||
return targets.filter(target => {
|
||||
if (target.advanced && !showAdvanced) {
|
||||
|
@ -17,7 +17,7 @@ export default Component.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@computed("currentTargetName", "onlyOverridden", "theme.fields")
|
||||
@discourseComputed("currentTargetName", "onlyOverridden", "theme.fields")
|
||||
visibleFields(targetName, onlyOverridden, fields) {
|
||||
fields = fields[targetName];
|
||||
if (onlyOverridden) {
|
||||
|
@ -26,14 +26,14 @@ export default Component.extend({
|
|||
return fields;
|
||||
},
|
||||
|
||||
@computed("currentTargetName", "fieldName")
|
||||
@discourseComputed("currentTargetName", "fieldName")
|
||||
activeSectionMode(targetName, fieldName) {
|
||||
if (["settings", "translations"].includes(targetName)) return "yaml";
|
||||
if (["extra_scss"].includes(targetName)) return "scss";
|
||||
return fieldName && fieldName.indexOf("scss") > -1 ? "scss" : "html";
|
||||
},
|
||||
|
||||
@computed("fieldName", "currentTargetName", "theme")
|
||||
@discourseComputed("fieldName", "currentTargetName", "theme")
|
||||
activeSection: {
|
||||
get(fieldName, target, model) {
|
||||
return model.getField(target, fieldName);
|
||||
|
@ -46,17 +46,21 @@ export default Component.extend({
|
|||
|
||||
editorId: fmt("fieldName", "currentTargetName", "%@|%@"),
|
||||
|
||||
@computed("maximized")
|
||||
@discourseComputed("maximized")
|
||||
maximizeIcon(maximized) {
|
||||
return maximized ? "discourse-compress" : "discourse-expand";
|
||||
},
|
||||
|
||||
@computed("currentTargetName", "theme.targets")
|
||||
@discourseComputed("currentTargetName", "theme.targets")
|
||||
showAddField(currentTargetName, targets) {
|
||||
return targets.find(t => t.name === currentTargetName).customNames;
|
||||
},
|
||||
|
||||
@computed("currentTargetName", "fieldName", "theme.theme_fields.@each.error")
|
||||
@discourseComputed(
|
||||
"currentTargetName",
|
||||
"fieldName",
|
||||
"theme.theme_fields.@each.error"
|
||||
)
|
||||
error(target, fieldName) {
|
||||
return this.theme.getError(target, fieldName);
|
||||
},
|
||||
|
|
|
@ -8,10 +8,10 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
|||
import { propertyEqual } from "discourse/lib/computed";
|
||||
import { i18n } from "discourse/lib/computed";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes,
|
||||
on
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend(bufferedProperty("userField"), {
|
||||
editing: empty("userField.id"),
|
||||
|
@ -22,7 +22,7 @@ export default Component.extend(bufferedProperty("userField"), {
|
|||
|
||||
userFieldsDescription: i18n("admin.user_fields.description"),
|
||||
|
||||
@computed("buffered.field_type")
|
||||
@discourseComputed("buffered.field_type")
|
||||
bufferedFieldType(fieldType) {
|
||||
return UserField.fieldTypeById(fieldType);
|
||||
},
|
||||
|
@ -39,12 +39,12 @@ export default Component.extend(bufferedProperty("userField"), {
|
|||
$(".user-field-name").select();
|
||||
},
|
||||
|
||||
@computed("userField.field_type")
|
||||
@discourseComputed("userField.field_type")
|
||||
fieldName(fieldType) {
|
||||
return UserField.fieldTypeById(fieldType).get("name");
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"userField.editable",
|
||||
"userField.required",
|
||||
"userField.show_on_profile",
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["hook-event"],
|
||||
typeName: alias("type.name"),
|
||||
|
||||
@computed("typeName")
|
||||
@discourseComputed("typeName")
|
||||
name(typeName) {
|
||||
return I18n.t(`admin.web_hooks.${typeName}_event.name`);
|
||||
},
|
||||
|
||||
@computed("typeName")
|
||||
@discourseComputed("typeName")
|
||||
details(typeName) {
|
||||
return I18n.t(`admin.web_hooks.${typeName}_event.details`);
|
||||
},
|
||||
|
||||
@computed("model.[]", "typeName")
|
||||
@discourseComputed("model.[]", "typeName")
|
||||
eventTypeExists(eventTypes, typeName) {
|
||||
return eventTypes.any(event => event.name === typeName);
|
||||
},
|
||||
|
||||
@computed("eventTypeExists")
|
||||
@discourseComputed("eventTypeExists")
|
||||
enabled: {
|
||||
get(eventTypeExists) {
|
||||
return eventTypeExists;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { ensureJSON, plainJSON, prettyJSON } from "discourse/lib/formatter";
|
||||
|
@ -10,7 +10,7 @@ export default Component.extend({
|
|||
expandDetailsRequestKey: "request",
|
||||
expandDetailsResponseKey: "response",
|
||||
|
||||
@computed("model.status")
|
||||
@discourseComputed("model.status")
|
||||
statusColorClasses(status) {
|
||||
if (!status) return "";
|
||||
|
||||
|
@ -21,25 +21,25 @@ export default Component.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("model.created_at")
|
||||
@discourseComputed("model.created_at")
|
||||
createdAt(createdAt) {
|
||||
return moment(createdAt).format("YYYY-MM-DD HH:mm:ss");
|
||||
},
|
||||
|
||||
@computed("model.duration")
|
||||
@discourseComputed("model.duration")
|
||||
completion(duration) {
|
||||
const seconds = Math.floor(duration / 10.0) / 100.0;
|
||||
return I18n.t("admin.web_hooks.events.completed_in", { count: seconds });
|
||||
},
|
||||
|
||||
@computed("expandDetails")
|
||||
@discourseComputed("expandDetails")
|
||||
expandRequestIcon(expandDetails) {
|
||||
return expandDetails === this.expandDetailsRequestKey
|
||||
? "ellipsis-h"
|
||||
: "ellipsis-v";
|
||||
},
|
||||
|
||||
@computed("expandDetails")
|
||||
@discourseComputed("expandDetails")
|
||||
expandResponseIcon(expandDetails) {
|
||||
return expandDetails === this.expandDetailsResponseKey
|
||||
? "ellipsis-h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
|
||||
|
@ -8,17 +8,17 @@ export default Component.extend(
|
|||
classes: ["text-muted", "text-danger", "text-successful", "text-muted"],
|
||||
icons: ["far-circle", "times-circle", "circle", "circle"],
|
||||
|
||||
@computed("deliveryStatuses", "model.last_delivery_status")
|
||||
@discourseComputed("deliveryStatuses", "model.last_delivery_status")
|
||||
status(deliveryStatuses, lastDeliveryStatus) {
|
||||
return deliveryStatuses.find(s => s.id === lastDeliveryStatus);
|
||||
},
|
||||
|
||||
@computed("status.id", "icons")
|
||||
@discourseComputed("status.id", "icons")
|
||||
icon(statusId, icons) {
|
||||
return icons[statusId - 1];
|
||||
},
|
||||
|
||||
@computed("status.id", "classes")
|
||||
@discourseComputed("status.id", "classes")
|
||||
class(statusId, classes) {
|
||||
return classes[statusId - 1];
|
||||
},
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { reads } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
editorId: reads("fieldName"),
|
||||
|
||||
@computed("fieldName")
|
||||
@discourseComputed("fieldName")
|
||||
currentEditorMode(fieldName) {
|
||||
return fieldName === "css" ? "scss" : fieldName;
|
||||
},
|
||||
|
||||
@computed("fieldName", "styles.html", "styles.css")
|
||||
@discourseComputed("fieldName", "styles.html", "styles.css")
|
||||
resetDisabled(fieldName) {
|
||||
return (
|
||||
this.get(`styles.${fieldName}`) ===
|
||||
|
@ -18,7 +18,7 @@ export default Component.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@computed("styles", "fieldName")
|
||||
@discourseComputed("styles", "fieldName")
|
||||
editorContents: {
|
||||
get(styles, fieldName) {
|
||||
return styles[fieldName];
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { or } from "@ember/object/computed";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||
import { on, observes } from "discourse-common/utils/decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Component.extend(bufferedProperty("host"), {
|
||||
|
@ -22,7 +22,7 @@ export default Component.extend(bufferedProperty("host"), {
|
|||
});
|
||||
},
|
||||
|
||||
@computed("buffered.host", "host.isSaving")
|
||||
@discourseComputed("buffered.host", "host.isSaving")
|
||||
cantSave(host, isSaving) {
|
||||
return isSaving || isEmpty(host);
|
||||
},
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["embed-setting"],
|
||||
|
||||
@computed("field")
|
||||
@discourseComputed("field")
|
||||
inputId(field) {
|
||||
return field.dasherize();
|
||||
},
|
||||
|
||||
@computed("field")
|
||||
@discourseComputed("field")
|
||||
translationKey(field) {
|
||||
return `admin.embedding.${field}`;
|
||||
},
|
||||
|
||||
@computed("type")
|
||||
@discourseComputed("type")
|
||||
isCheckbox(type) {
|
||||
return type === "checkbox";
|
||||
},
|
||||
|
||||
@computed("value")
|
||||
@discourseComputed("value")
|
||||
checked: {
|
||||
get(value) {
|
||||
return !!value;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Component from "@ember/component";
|
||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||
import { on, observes } from "discourse-common/utils/decorators";
|
||||
import highlightSyntax from "discourse/lib/highlight-syntax";
|
||||
|
||||
export default Component.extend({
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["inline-edit"],
|
||||
|
@ -21,12 +21,12 @@ export default Component.extend({
|
|||
this.set("checkedInternal", this.checked);
|
||||
},
|
||||
|
||||
@computed("labelKey")
|
||||
@discourseComputed("labelKey")
|
||||
label(key) {
|
||||
return I18n.t(key);
|
||||
},
|
||||
|
||||
@computed("checked", "checkedInternal")
|
||||
@discourseComputed("checked", "checkedInternal")
|
||||
changed(checked, checkedInternal) {
|
||||
return !!checked !== !!checkedInternal;
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import copyText from "discourse/lib/copy-text";
|
||||
|
@ -9,7 +9,7 @@ import copyText from "discourse/lib/copy-text";
|
|||
export default Component.extend({
|
||||
classNames: ["ip-lookup"],
|
||||
|
||||
@computed("other_accounts.length", "totalOthersWithSameIP")
|
||||
@discourseComputed("other_accounts.length", "totalOthersWithSameIP")
|
||||
otherAccountsToDelete(otherAccountsLength, totalOthersWithSameIP) {
|
||||
// can only delete up to 50 accounts at a time
|
||||
const total = Math.min(50, totalOthersWithSameIP || 0);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { equal } from "@ember/object/computed";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const ACTIONS = ["delete", "delete_replies", "edit", "none"];
|
||||
|
||||
|
@ -10,7 +10,7 @@ export default Component.extend({
|
|||
postAction: null,
|
||||
postEdit: null,
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
penaltyActions() {
|
||||
return ACTIONS.map(id => {
|
||||
return { id, name: I18n.t(`admin.user.penalty_post_${id}`) };
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
import Permalink from "admin/models/permalink";
|
||||
|
||||
|
@ -10,7 +10,7 @@ export default Component.extend({
|
|||
permalinkType: "topic_id",
|
||||
permalinkTypePlaceholder: fmt("permalinkType", "admin.permalink.%@"),
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
permalinkTypes() {
|
||||
return [
|
||||
{ id: "topic_id", name: I18n.t("admin.permalink.topic_id") },
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Category from "discourse/models/category";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import FilterComponent from "admin/components/report-filters/filter";
|
||||
|
||||
export default FilterComponent.extend({
|
||||
|
@ -7,7 +7,7 @@ export default FilterComponent.extend({
|
|||
|
||||
layoutName: "admin/templates/components/report-filters/category",
|
||||
|
||||
@computed("filter.default")
|
||||
@discourseComputed("filter.default")
|
||||
category(categoryId) {
|
||||
return Category.findById(categoryId);
|
||||
},
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import FilterComponent from "admin/components/report-filters/filter";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
|
||||
export default FilterComponent.extend({
|
||||
classNames: ["group-filter"],
|
||||
|
||||
layoutName: "admin/templates/components/report-filters/group",
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
groupOptions() {
|
||||
return (this.site.groups || []).map(group => {
|
||||
return { name: group["name"], value: group["id"] };
|
||||
});
|
||||
},
|
||||
|
||||
@computed("filter.default")
|
||||
@discourseComputed("filter.default")
|
||||
groupId(filterDefault) {
|
||||
return filterDefault ? parseInt(filterDefault, 10) : null;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import Component from "@ember/component";
|
|||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
on
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
/*global Resumable:true */
|
||||
|
||||
|
@ -91,12 +91,12 @@ export default Component.extend(
|
|||
}
|
||||
},
|
||||
|
||||
@computed("title", "text")
|
||||
@discourseComputed("title", "text")
|
||||
translatedTitle(title, text) {
|
||||
return title ? I18n.t(title) : text;
|
||||
},
|
||||
|
||||
@computed("isUploading", "progress")
|
||||
@discourseComputed("isUploading", "progress")
|
||||
text(isUploading, progress) {
|
||||
if (isUploading) {
|
||||
return progress + " %";
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { or } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["controls"],
|
||||
|
||||
buttonDisabled: or("model.isSaving", "saveDisabled"),
|
||||
|
||||
@computed("model.isSaving")
|
||||
@discourseComputed("model.isSaving")
|
||||
savingText(saving) {
|
||||
return saving ? "saving" : "save";
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
/**
|
||||
|
@ -12,20 +13,19 @@ import Component from "@ember/component";
|
|||
**/
|
||||
|
||||
import ScreenedIpAddress from "admin/models/screened-ip-address";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["screened-ip-address-form"],
|
||||
formSubmitted: false,
|
||||
actionName: "block",
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
adminWhitelistEnabled() {
|
||||
return Discourse.SiteSettings.use_admin_ip_whitelist;
|
||||
},
|
||||
|
||||
@computed("adminWhitelistEnabled")
|
||||
@discourseComputed("adminWhitelistEnabled")
|
||||
actionNames(adminWhitelistEnabled) {
|
||||
if (adminWhitelistEnabled) {
|
||||
return [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { isEmpty } from "@ember/utils";
|
||||
import Component from "@ember/component";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
import { set } from "@ember/object";
|
||||
|
||||
export default Component.extend({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
@computed("value")
|
||||
@discourseComputed("value")
|
||||
enabled: {
|
||||
get(value) {
|
||||
if (isEmpty(value)) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
@computed("value")
|
||||
@discourseComputed("value")
|
||||
selectedCategories: {
|
||||
get(value) {
|
||||
return Discourse.Category.findByIds(value.split("|"));
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
groupChoices() {
|
||||
return this.site.get("groups").map(g => {
|
||||
return { name: g.name, id: g.id.toString() };
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
@computed("value")
|
||||
@discourseComputed("value")
|
||||
selectedTags: {
|
||||
get(value) {
|
||||
return value.split("|");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Component from "@ember/component";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["site-text"],
|
||||
|
|
|
@ -2,9 +2,9 @@ import { gt, and } from "@ember/object/computed";
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { escape } from "pretty-text/sanitizer";
|
||||
import ENV from "discourse-common/config/environment";
|
||||
|
@ -55,7 +55,7 @@ export default Component.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"theme.component",
|
||||
"theme.childThemes.@each.name",
|
||||
"theme.childThemes.length",
|
||||
|
@ -76,12 +76,12 @@ export default Component.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@computed("children")
|
||||
@discourseComputed("children")
|
||||
childrenString(children) {
|
||||
return children.join(", ");
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"theme.childThemes.length",
|
||||
"theme.component",
|
||||
"childrenExpanded",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { gt, equal } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import { THEMES, COMPONENTS } from "admin/models/theme";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { getOwner } from "@ember/application";
|
||||
|
||||
export default Component.extend({
|
||||
|
@ -17,7 +17,7 @@ export default Component.extend({
|
|||
themesTabActive: equal("currentTab", THEMES),
|
||||
componentsTabActive: equal("currentTab", COMPONENTS),
|
||||
|
||||
@computed("themes", "components", "currentTab")
|
||||
@discourseComputed("themes", "components", "currentTab")
|
||||
themesList(themes, components) {
|
||||
if (this.themesTabActive) {
|
||||
return themes;
|
||||
|
@ -26,7 +26,7 @@ export default Component.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"themesList",
|
||||
"currentTab",
|
||||
"themesList.@each.user_selectable",
|
||||
|
@ -41,7 +41,7 @@ export default Component.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"themesList",
|
||||
"currentTab",
|
||||
"themesList.@each.user_selectable",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { empty, alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNameBindings: [":value-list"],
|
||||
|
@ -30,7 +30,7 @@ export default Component.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@computed("choices.[]", "collection.[]")
|
||||
@discourseComputed("choices.[]", "collection.[]")
|
||||
filteredChoices(choices, collection) {
|
||||
return makeArray(choices).filter(i => collection.indexOf(i) < 0);
|
||||
},
|
||||
|
|
|
@ -3,10 +3,10 @@ import { schedule } from "@ember/runloop";
|
|||
import Component from "@ember/component";
|
||||
import WatchedWord from "admin/models/watched-word";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
on,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["watched-word-form"],
|
||||
|
@ -14,7 +14,7 @@ export default Component.extend({
|
|||
actionKey: null,
|
||||
showMessage: false,
|
||||
|
||||
@computed("regularExpressions")
|
||||
@discourseComputed("regularExpressions")
|
||||
placeholderKey(regularExpressions) {
|
||||
return (
|
||||
"admin.watched_words.form.placeholder" +
|
||||
|
@ -29,7 +29,7 @@ export default Component.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("word")
|
||||
@discourseComputed("word")
|
||||
isUniqueWord(word) {
|
||||
const words = this.filteredContent || [];
|
||||
const filtered = words.filter(content => content.action === this.actionKey);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import UploadMixin from "discourse/mixins/upload";
|
||||
|
||||
export default Component.extend(UploadMixin, {
|
||||
|
@ -13,7 +13,7 @@ export default Component.extend(UploadMixin, {
|
|||
return { skipValidation: true };
|
||||
},
|
||||
|
||||
@computed("actionKey")
|
||||
@discourseComputed("actionKey")
|
||||
data(actionKey) {
|
||||
return { action_key: actionKey };
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
|
@ -7,12 +7,12 @@ export default Ember.Controller.extend({
|
|||
{ id: "single", name: I18n.t("admin.api.single_user") }
|
||||
],
|
||||
|
||||
@computed("userMode")
|
||||
@discourseComputed("userMode")
|
||||
showUserSelector(mode) {
|
||||
return mode === "single";
|
||||
},
|
||||
|
||||
@computed("model.description", "model.username", "userMode")
|
||||
@discourseComputed("model.description", "model.username", "userMode")
|
||||
saveDisabled(description, username, userMode) {
|
||||
if (Ember.isBlank(description)) return true;
|
||||
if (userMode === "single" && Ember.isBlank(username)) return true;
|
||||
|
|
|
@ -2,7 +2,7 @@ import { alias, equal } from "@ember/object/computed";
|
|||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { setting, i18n } from "discourse/lib/computed";
|
||||
|
||||
export default Controller.extend({
|
||||
|
@ -12,7 +12,7 @@ export default Controller.extend({
|
|||
backupLocation: setting("backup_location"),
|
||||
localBackupStorage: equal("backupLocation", "local"),
|
||||
|
||||
@computed("status.allowRestore", "status.isOperationRunning")
|
||||
@discourseComputed("status.allowRestore", "status.isOperationRunning")
|
||||
restoreTitle(allowRestore, isOperationRunning) {
|
||||
if (!allowRestore) {
|
||||
return "admin.backups.operations.restore.is_disabled";
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
import { propertyNotEqual } from "discourse/lib/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend(bufferedProperty("model"), {
|
||||
adminBadges: inject(),
|
||||
|
@ -19,7 +19,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
readOnly: alias("buffered.system"),
|
||||
showDisplayName: propertyNotEqual("name", "displayName"),
|
||||
|
||||
@computed("model.query", "buffered.query")
|
||||
@discourseComputed("model.query", "buffered.query")
|
||||
hasQuery(modelQuery, bufferedQuery) {
|
||||
if (bufferedQuery) {
|
||||
return bufferedQuery.trim().length > 0;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { later } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
@computed("model.colors", "onlyOverridden")
|
||||
@discourseComputed("model.colors", "onlyOverridden")
|
||||
colors(allColors, onlyOverridden) {
|
||||
if (onlyOverridden) {
|
||||
return allColors.filter(color => color.get("overridden"));
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
@computed("model.@each.id")
|
||||
@discourseComputed("model.@each.id")
|
||||
baseColorScheme() {
|
||||
return this.model.findBy("is_base", true);
|
||||
},
|
||||
|
||||
@computed("model.@each.id")
|
||||
@discourseComputed("model.@each.id")
|
||||
baseColorSchemes() {
|
||||
return this.model.filterBy("is_base", true);
|
||||
},
|
||||
|
||||
@computed("baseColorScheme")
|
||||
@discourseComputed("baseColorScheme")
|
||||
baseColors(baseColorScheme) {
|
||||
const baseColorsHash = EmberObject.create({});
|
||||
baseColorScheme.get("colors").forEach(color => {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
@computed("model.isSaving")
|
||||
@discourseComputed("model.isSaving")
|
||||
saveButtonText(isSaving) {
|
||||
return isSaving ? I18n.t("saving") : I18n.t("admin.customize.save");
|
||||
},
|
||||
|
||||
@computed("model.changed", "model.isSaving")
|
||||
@discourseComputed("model.changed", "model.isSaving")
|
||||
saveDisabled(changed, isSaving) {
|
||||
return !changed || isSaving;
|
||||
},
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend(bufferedProperty("emailTemplate"), {
|
||||
saved: false,
|
||||
|
||||
@computed("buffered.body", "buffered.subject")
|
||||
@discourseComputed("buffered.body", "buffered.subject")
|
||||
saveDisabled(body, subject) {
|
||||
return (
|
||||
this.emailTemplate.body === body && this.emailTemplate.subject === subject
|
||||
);
|
||||
},
|
||||
|
||||
@computed("buffered")
|
||||
@discourseComputed("buffered")
|
||||
hasMultipleSubjects(buffered) {
|
||||
if (buffered.getProperties("subject")["subject"]) {
|
||||
return false;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Controller from "@ember/controller";
|
||||
import { url } from "discourse/lib/computed";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
section: null,
|
||||
|
@ -16,7 +16,7 @@ export default Controller.extend({
|
|||
this.set("currentTarget", target && target.id);
|
||||
},
|
||||
|
||||
@computed("currentTarget")
|
||||
@discourseComputed("currentTarget")
|
||||
currentTargetName(id) {
|
||||
const target = this.get("model.targets").find(
|
||||
t => t.id === parseInt(id, 10)
|
||||
|
@ -24,12 +24,12 @@ export default Controller.extend({
|
|||
return target && target.name;
|
||||
},
|
||||
|
||||
@computed("model.isSaving")
|
||||
@discourseComputed("model.isSaving")
|
||||
saveButtonText(isSaving) {
|
||||
return isSaving ? I18n.t("saving") : I18n.t("admin.customize.save");
|
||||
},
|
||||
|
||||
@computed("model.changed", "model.isSaving")
|
||||
@discourseComputed("model.changed", "model.isSaving")
|
||||
saveDisabled(changed, isSaving) {
|
||||
return !changed || isSaving;
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { empty, notEmpty, match } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { url } from "discourse/lib/computed";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
|
@ -16,7 +16,7 @@ export default Controller.extend({
|
|||
addButtonDisabled: empty("selectedChildThemeId"),
|
||||
editRouteName: "adminCustomizeThemes.edit",
|
||||
|
||||
@computed("model.editedFields")
|
||||
@discourseComputed("model.editedFields")
|
||||
editedFieldsFormatted() {
|
||||
const descriptions = [];
|
||||
["common", "desktop", "mobile"].forEach(target => {
|
||||
|
@ -34,13 +34,13 @@ export default Controller.extend({
|
|||
return descriptions;
|
||||
},
|
||||
|
||||
@computed("colorSchemeId", "model.color_scheme_id")
|
||||
@discourseComputed("colorSchemeId", "model.color_scheme_id")
|
||||
colorSchemeChanged(colorSchemeId, existingId) {
|
||||
colorSchemeId = colorSchemeId === null ? null : parseInt(colorSchemeId);
|
||||
return colorSchemeId !== existingId;
|
||||
},
|
||||
|
||||
@computed("availableChildThemes", "model.childThemes.[]", "model")
|
||||
@discourseComputed("availableChildThemes", "model.childThemes.[]", "model")
|
||||
selectableChildThemes(available, childThemes) {
|
||||
if (available) {
|
||||
const themes = !childThemes
|
||||
|
@ -50,7 +50,7 @@ export default Controller.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("allThemes", "model.component", "model")
|
||||
@discourseComputed("allThemes", "model.component", "model")
|
||||
availableChildThemes(allThemes) {
|
||||
if (!this.get("model.component")) {
|
||||
const themeId = this.get("model.id");
|
||||
|
@ -60,38 +60,38 @@ export default Controller.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("model.component")
|
||||
@discourseComputed("model.component")
|
||||
convertKey(component) {
|
||||
const type = component ? "component" : "theme";
|
||||
return `admin.customize.theme.convert_${type}`;
|
||||
},
|
||||
|
||||
@computed("model.component")
|
||||
@discourseComputed("model.component")
|
||||
convertIcon(component) {
|
||||
return component ? "cube" : "";
|
||||
},
|
||||
|
||||
@computed("model.component")
|
||||
@discourseComputed("model.component")
|
||||
convertTooltip(component) {
|
||||
const type = component ? "component" : "theme";
|
||||
return `admin.customize.theme.convert_${type}_tooltip`;
|
||||
},
|
||||
|
||||
@computed("model.settings")
|
||||
@discourseComputed("model.settings")
|
||||
settings(settings) {
|
||||
return settings.map(setting => ThemeSettings.create(setting));
|
||||
},
|
||||
|
||||
hasSettings: notEmpty("settings"),
|
||||
|
||||
@computed("model.translations")
|
||||
@discourseComputed("model.translations")
|
||||
translations(translations) {
|
||||
return translations.map(setting => ThemeSettings.create(setting));
|
||||
},
|
||||
|
||||
hasTranslations: notEmpty("translations"),
|
||||
|
||||
@computed("model.remoteError", "updatingRemote")
|
||||
@discourseComputed("model.remoteError", "updatingRemote")
|
||||
showRemoteError(errorMessage, updating) {
|
||||
return errorMessage && !updating;
|
||||
},
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { THEMES } from "admin/models/theme";
|
||||
|
||||
export default Controller.extend({
|
||||
currentTab: THEMES,
|
||||
|
||||
@computed("model", "model.@each.component")
|
||||
@discourseComputed("model", "model.@each.component")
|
||||
fullThemes(themes) {
|
||||
return themes.filter(t => !t.get("component"));
|
||||
},
|
||||
|
||||
@computed("model", "model.@each.component")
|
||||
@discourseComputed("model", "model.@each.component")
|
||||
childThemes(themes) {
|
||||
return themes.filter(t => t.get("component"));
|
||||
},
|
||||
|
||||
@computed("model", "model.@each.component")
|
||||
@discourseComputed("model", "model.@each.component")
|
||||
installedThemes(themes) {
|
||||
return themes.map(t => t.name);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import AdminDashboard from "admin/models/admin-dashboard";
|
||||
import Report from "admin/models/report";
|
||||
import PeriodComputationMixin from "admin/mixins/period-computation";
|
||||
|
@ -20,12 +20,12 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
logSearchQueriesEnabled: setting("log_search_queries"),
|
||||
basePath: Discourse.BaseUri,
|
||||
|
||||
@computed("siteSettings.dashboard_general_tab_activity_metrics")
|
||||
@discourseComputed("siteSettings.dashboard_general_tab_activity_metrics")
|
||||
activityMetrics(metrics) {
|
||||
return (metrics || "").split("|").filter(m => m);
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
activityMetricsFilters() {
|
||||
return {
|
||||
startDate: this.lastMonth,
|
||||
|
@ -33,14 +33,14 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
topReferredTopicsOptions() {
|
||||
return {
|
||||
table: { total: false, limit: 8 }
|
||||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
topReferredTopicsFilters() {
|
||||
return {
|
||||
startDate: moment()
|
||||
|
@ -50,7 +50,7 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
trendingSearchFilters() {
|
||||
return {
|
||||
startDate: moment()
|
||||
|
@ -60,14 +60,14 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
trendingSearchOptions() {
|
||||
return {
|
||||
table: { total: false, limit: 8 }
|
||||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
trendingSearchDisabledLabel() {
|
||||
return I18n.t("admin.dashboard.reports.trending_search.disabled", {
|
||||
basePath: Discourse.BaseUri
|
||||
|
@ -107,7 +107,7 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
}
|
||||
},
|
||||
|
||||
@computed("startDate", "endDate")
|
||||
@discourseComputed("startDate", "endDate")
|
||||
filters(startDate, endDate) {
|
||||
return { startDate, endDate };
|
||||
},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import PeriodComputationMixin from "admin/mixins/period-computation";
|
||||
|
||||
export default Controller.extend(PeriodComputationMixin, {
|
||||
@computed
|
||||
@discourseComputed
|
||||
flagsStatusOptions() {
|
||||
return {
|
||||
table: {
|
||||
|
@ -13,7 +13,7 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
userFlaggingRatioOptions() {
|
||||
return {
|
||||
table: {
|
||||
|
@ -23,12 +23,12 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
};
|
||||
},
|
||||
|
||||
@computed("startDate", "endDate")
|
||||
@discourseComputed("startDate", "endDate")
|
||||
filters(startDate, endDate) {
|
||||
return { startDate, endDate };
|
||||
},
|
||||
|
||||
@computed("lastWeek", "endDate")
|
||||
@discourseComputed("lastWeek", "endDate")
|
||||
lastWeekfilters(startDate, endDate) {
|
||||
return { startDate, endDate };
|
||||
},
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { debounce } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const { get } = Ember;
|
||||
|
||||
export default Controller.extend({
|
||||
filter: null,
|
||||
|
||||
@computed("model.[]", "filter")
|
||||
@discourseComputed("model.[]", "filter")
|
||||
filterReports(reports, filter) {
|
||||
if (filter) {
|
||||
filter = filter.toLowerCase();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import AdminDashboard from "admin/models/admin-dashboard";
|
||||
import VersionCheck from "admin/models/version-check";
|
||||
|
||||
|
@ -13,7 +13,7 @@ export default Controller.extend({
|
|||
exceptionController: inject("exception"),
|
||||
showVersionChecks: setting("version_checks"),
|
||||
|
||||
@computed("problems.length")
|
||||
@discourseComputed("problems.length")
|
||||
foundProblems(problemsLength) {
|
||||
return this.currentUser.get("admin") && (problemsLength || 0) > 0;
|
||||
},
|
||||
|
@ -77,7 +77,7 @@ export default Controller.extend({
|
|||
.finally(() => this.set("loadingProblems", false));
|
||||
},
|
||||
|
||||
@computed("problemsFetchedAt")
|
||||
@discourseComputed("problemsFetchedAt")
|
||||
problemsTimestamp(problemsFetchedAt) {
|
||||
return moment(problemsFetchedAt)
|
||||
.locale("en")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Controller.extend({
|
||||
|
@ -7,13 +7,13 @@ export default Controller.extend({
|
|||
embedding: null,
|
||||
|
||||
// show settings if we have at least one created host
|
||||
@computed("embedding.embeddable_hosts.@each.isCreated")
|
||||
@discourseComputed("embedding.embeddable_hosts.@each.isCreated")
|
||||
showSecondary() {
|
||||
const hosts = this.get("embedding.embeddable_hosts");
|
||||
return hosts.length && hosts.findBy("isCreated");
|
||||
},
|
||||
|
||||
@computed("embedding.base_url")
|
||||
@discourseComputed("embedding.base_url")
|
||||
embeddingCode(baseUrl) {
|
||||
const html = `<div id='discourse-comments'></div>
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import Controller from "@ember/controller";
|
|||
import { exportEntity } from "discourse/lib/export-csv";
|
||||
import { outputExportResult } from "discourse/lib/export-result";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
on
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
model: null,
|
||||
|
@ -15,7 +15,7 @@ export default Controller.extend({
|
|||
filtersExists: gt("filterCount", 0),
|
||||
userHistoryActions: null,
|
||||
|
||||
@computed("filters.action_name")
|
||||
@discourseComputed("filters.action_name")
|
||||
actionFilter(name) {
|
||||
return name ? I18n.t("admin.logs.staff_actions.actions." + name) : null;
|
||||
},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
@computed
|
||||
@discourseComputed
|
||||
adminRoutes: function() {
|
||||
return this.model
|
||||
.map(p => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
queryParams: ["start_date", "end_date", "filters"],
|
||||
|
@ -7,7 +7,7 @@ export default Controller.extend({
|
|||
end_date: null,
|
||||
filters: null,
|
||||
|
||||
@computed("model.type")
|
||||
@discourseComputed("model.type")
|
||||
reportOptions(type) {
|
||||
let options = { table: { perPage: 50, limit: 50, formatNumbers: false } };
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
categoryNameKey: null,
|
||||
adminSiteSettings: inject(),
|
||||
|
||||
@computed("adminSiteSettings.visibleSiteSettings", "categoryNameKey")
|
||||
@discourseComputed("adminSiteSettings.visibleSiteSettings", "categoryNameKey")
|
||||
category(categories, nameKey) {
|
||||
return (categories || []).findBy("nameKey", nameKey);
|
||||
},
|
||||
|
||||
@computed("category")
|
||||
@discourseComputed("category")
|
||||
filteredContent(category) {
|
||||
return category ? category.siteSettings : [];
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend(bufferedProperty("siteText"), {
|
||||
saved: false,
|
||||
|
||||
@computed("buffered.value")
|
||||
@discourseComputed("buffered.value")
|
||||
saveDisabled(value) {
|
||||
return this.siteText.value === value;
|
||||
},
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias, sort } from "@ember/object/computed";
|
||||
import { next } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import GrantBadgeController from "discourse/mixins/grant-badge-controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend(GrantBadgeController, {
|
||||
adminUser: inject(),
|
||||
|
@ -19,7 +19,7 @@ export default Controller.extend(GrantBadgeController, {
|
|||
this.badgeSortOrder = ["granted_at:desc"];
|
||||
},
|
||||
|
||||
@computed("model", "model.[]", "model.expandedBadges.[]")
|
||||
@discourseComputed("model", "model.[]", "model.expandedBadges.[]")
|
||||
groupedBadges() {
|
||||
const allBadges = this.model;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import CanCheckEmails from "discourse/mixins/can-check-emails";
|
|||
import { propertyNotEqual, setting } from "discourse/lib/computed";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
|
||||
|
@ -30,12 +30,12 @@ export default Controller.extend(CanCheckEmails, {
|
|||
"model.can_disable_second_factor"
|
||||
),
|
||||
|
||||
@computed("model.customGroups")
|
||||
@discourseComputed("model.customGroups")
|
||||
customGroupIds(customGroups) {
|
||||
return customGroups.mapBy("id");
|
||||
},
|
||||
|
||||
@computed("customGroupIdsBuffer", "customGroupIds")
|
||||
@discourseComputed("customGroupIdsBuffer", "customGroupIds")
|
||||
customGroupsDirty(buffer, original) {
|
||||
if (buffer === null) return false;
|
||||
|
||||
|
@ -44,7 +44,7 @@ export default Controller.extend(CanCheckEmails, {
|
|||
: true;
|
||||
},
|
||||
|
||||
@computed("model.automaticGroups")
|
||||
@discourseComputed("model.automaticGroups")
|
||||
automaticGroups(automaticGroups) {
|
||||
return automaticGroups
|
||||
.map(group => {
|
||||
|
@ -54,26 +54,30 @@ export default Controller.extend(CanCheckEmails, {
|
|||
.join(", ");
|
||||
},
|
||||
|
||||
@computed("model.associated_accounts")
|
||||
@discourseComputed("model.associated_accounts")
|
||||
associatedAccountsLoaded(associatedAccounts) {
|
||||
return typeof associatedAccounts !== "undefined";
|
||||
},
|
||||
|
||||
@computed("model.associated_accounts")
|
||||
@discourseComputed("model.associated_accounts")
|
||||
associatedAccounts(associatedAccounts) {
|
||||
return associatedAccounts
|
||||
.map(provider => `${provider.name} (${provider.description})`)
|
||||
.join(", ");
|
||||
},
|
||||
|
||||
@computed("model.user_fields.[]")
|
||||
@discourseComputed("model.user_fields.[]")
|
||||
userFields(userFields) {
|
||||
return this.site.collectUserFields(userFields);
|
||||
},
|
||||
|
||||
preferencesPath: fmt("model.username_lower", userPath("%@/preferences")),
|
||||
|
||||
@computed("model.can_delete_all_posts", "model.staff", "model.post_count")
|
||||
@discourseComputed(
|
||||
"model.can_delete_all_posts",
|
||||
"model.staff",
|
||||
"model.post_count"
|
||||
)
|
||||
deleteAllPostsExplanation(canDeleteAllPosts, staff, postCount) {
|
||||
if (canDeleteAllPosts) {
|
||||
return null;
|
||||
|
@ -93,7 +97,7 @@ export default Controller.extend(CanCheckEmails, {
|
|||
}
|
||||
},
|
||||
|
||||
@computed("model.canBeDeleted", "model.staff")
|
||||
@discourseComputed("model.canBeDeleted", "model.staff")
|
||||
deleteExplanation(canBeDeleted, staff) {
|
||||
if (canBeDeleted) {
|
||||
return null;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import { i18n } from "discourse/lib/computed";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import CanCheckEmails from "discourse/mixins/can-check-emails";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend(CanCheckEmails, {
|
||||
model: null,
|
||||
|
@ -24,7 +24,7 @@ export default Controller.extend(CanCheckEmails, {
|
|||
this._canLoadMore = true;
|
||||
},
|
||||
|
||||
@computed("query")
|
||||
@discourseComputed("query")
|
||||
title(query) {
|
||||
return I18n.t("admin.users.titles." + query);
|
||||
},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { or } from "@ember/object/computed";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import WatchedWord from "admin/models/watched-word";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
|
@ -27,22 +27,22 @@ export default Controller.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@computed("actionNameKey", "adminWatchedWords.model")
|
||||
@discourseComputed("actionNameKey", "adminWatchedWords.model")
|
||||
currentAction(actionName) {
|
||||
return this.findAction(actionName);
|
||||
},
|
||||
|
||||
@computed("currentAction.words.[]", "adminWatchedWords.model")
|
||||
@discourseComputed("currentAction.words.[]", "adminWatchedWords.model")
|
||||
filteredContent(words) {
|
||||
return words || [];
|
||||
},
|
||||
|
||||
@computed("actionNameKey")
|
||||
@discourseComputed("actionNameKey")
|
||||
actionDescription(actionNameKey) {
|
||||
return I18n.t("admin.watched_words.action_descriptions." + actionNameKey);
|
||||
},
|
||||
|
||||
@computed("currentAction.count")
|
||||
@discourseComputed("currentAction.count")
|
||||
wordCount(count) {
|
||||
return count || 0;
|
||||
},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
pingDisabled: false,
|
||||
|
@ -14,7 +14,7 @@ export default Controller.extend({
|
|||
this.incomingEventIds = [];
|
||||
},
|
||||
|
||||
@computed("incomingCount")
|
||||
@discourseComputed("incomingCount")
|
||||
hasIncoming(incomingCount) {
|
||||
return incomingCount > 0;
|
||||
},
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { extractDomainFromUrl } from "discourse/lib/utilities";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import InputValidation from "discourse/models/input-validation";
|
||||
|
||||
export default Controller.extend({
|
||||
|
@ -13,12 +13,12 @@ export default Controller.extend({
|
|||
defaultEventTypes: alias("adminWebHooks.defaultEventTypes"),
|
||||
contentTypes: alias("adminWebHooks.contentTypes"),
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
showTagsFilter() {
|
||||
return this.siteSettings.tagging_enabled;
|
||||
},
|
||||
|
||||
@computed("model.isSaving", "saved", "saveButtonDisabled")
|
||||
@discourseComputed("model.isSaving", "saved", "saveButtonDisabled")
|
||||
savingStatus(isSaving, saved, saveButtonDisabled) {
|
||||
if (isSaving) {
|
||||
return I18n.t("saving");
|
||||
|
@ -30,14 +30,14 @@ export default Controller.extend({
|
|||
return "";
|
||||
},
|
||||
|
||||
@computed("model.isNew")
|
||||
@discourseComputed("model.isNew")
|
||||
saveButtonText(isNew) {
|
||||
return isNew
|
||||
? I18n.t("admin.web_hooks.create")
|
||||
: I18n.t("admin.web_hooks.save");
|
||||
},
|
||||
|
||||
@computed("model.secret")
|
||||
@discourseComputed("model.secret")
|
||||
secretValidation(secret) {
|
||||
if (!isEmpty(secret)) {
|
||||
if (secret.indexOf(" ") !== -1) {
|
||||
|
@ -56,7 +56,7 @@ export default Controller.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("model.wildcard_web_hook", "model.web_hook_event_types.[]")
|
||||
@discourseComputed("model.wildcard_web_hook", "model.web_hook_event_types.[]")
|
||||
eventTypeValidation(isWildcard, eventTypes) {
|
||||
if (!isWildcard && isEmpty(eventTypes)) {
|
||||
return InputValidation.create({
|
||||
|
@ -66,7 +66,7 @@ export default Controller.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"model.isSaving",
|
||||
"secretValidation",
|
||||
"eventTypeValidation",
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { inject as service } from "@ember/service";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { dasherize } from "@ember/string";
|
||||
|
||||
export default Controller.extend({
|
||||
router: service(),
|
||||
|
||||
@computed("siteSettings.enable_group_directory")
|
||||
@discourseComputed("siteSettings.enable_group_directory")
|
||||
showGroups(enableGroupDirectory) {
|
||||
return !enableGroupDirectory;
|
||||
},
|
||||
|
||||
@computed("siteSettings.enable_badges")
|
||||
@discourseComputed("siteSettings.enable_badges")
|
||||
showBadges(enableBadges) {
|
||||
return this.currentUser.get("admin") && enableBadges;
|
||||
},
|
||||
|
||||
@computed("router._router.currentPath")
|
||||
@discourseComputed("router._router.currentPath")
|
||||
adminContentsClassName(currentPath) {
|
||||
let cssClasses = currentPath
|
||||
.split(".")
|
||||
|
|
|
@ -5,9 +5,9 @@ import Controller from "@ember/controller";
|
|||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
const THEME_FIELD_VARIABLE_TYPE_IDS = [2, 3, 4];
|
||||
|
@ -69,7 +69,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
enabled: and("nameValid", "fileSelected"),
|
||||
disabled: not("enabled"),
|
||||
|
||||
@computed("name", "adminCustomizeThemesShow.model.theme_fields")
|
||||
@discourseComputed("name", "adminCustomizeThemesShow.model.theme_fields")
|
||||
errorMessage(name, themeFields) {
|
||||
if (name) {
|
||||
if (!name.match(/^[a-z_][a-z0-9_-]*$/i)) {
|
||||
|
@ -94,7 +94,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
return null;
|
||||
},
|
||||
|
||||
@computed("errorMessage")
|
||||
@discourseComputed("errorMessage")
|
||||
nameValid(errorMessage) {
|
||||
return null === errorMessage;
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { alias, map } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
|
||||
export default Controller.extend({
|
||||
|
@ -8,7 +8,7 @@ export default Controller.extend({
|
|||
errors: alias("model.errors"),
|
||||
count: alias("model.grant_count"),
|
||||
|
||||
@computed("count", "sample.length")
|
||||
@discourseComputed("count", "sample.length")
|
||||
countWarning(count, sampleLength) {
|
||||
if (count <= 10) {
|
||||
return sampleLength !== count;
|
||||
|
@ -17,12 +17,12 @@ export default Controller.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("model.query_plan")
|
||||
@discourseComputed("model.query_plan")
|
||||
hasQueryPlan(queryPlan) {
|
||||
return !!queryPlan;
|
||||
},
|
||||
|
||||
@computed("model.query_plan")
|
||||
@discourseComputed("model.query_plan")
|
||||
queryPlanHtml(queryPlan) {
|
||||
let output = `<pre class="badge-query-plan">`;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
@observes("model")
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import IncomingEmail from "admin/models/incoming-email";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { longDate } from "discourse/lib/formatter";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
@computed("model.date")
|
||||
@discourseComputed("model.date")
|
||||
date(d) {
|
||||
return longDate(d);
|
||||
},
|
||||
|
|
|
@ -5,9 +5,9 @@ import ModalFunctionality from "discourse/mixins/modal-functionality";
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { THEMES, COMPONENTS } from "admin/models/theme";
|
||||
import { POPULAR_THEMES } from "discourse-common/helpers/popular-themes";
|
||||
import { set } from "@ember/object";
|
||||
|
@ -43,7 +43,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
];
|
||||
},
|
||||
|
||||
@computed("themesController.installedThemes")
|
||||
@discourseComputed("themesController.installedThemes")
|
||||
themes(installedThemes) {
|
||||
return POPULAR_THEMES.map(t => {
|
||||
if (installedThemes.includes(t.name)) {
|
||||
|
@ -53,7 +53,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
});
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"loading",
|
||||
"remote",
|
||||
"uploadUrl",
|
||||
|
@ -102,12 +102,12 @@ export default Controller.extend(ModalFunctionality, {
|
|||
}
|
||||
},
|
||||
|
||||
@computed("name")
|
||||
@discourseComputed("name")
|
||||
nameTooShort(name) {
|
||||
return !name || name.length < MIN_NAME_LENGTH;
|
||||
},
|
||||
|
||||
@computed("component")
|
||||
@discourseComputed("component")
|
||||
placeholder(component) {
|
||||
if (component) {
|
||||
return I18n.t("admin.customize.theme.component_name");
|
||||
|
@ -116,14 +116,14 @@ export default Controller.extend(ModalFunctionality, {
|
|||
}
|
||||
},
|
||||
|
||||
@computed("selection")
|
||||
@discourseComputed("selection")
|
||||
submitLabel(selection) {
|
||||
return `admin.customize.theme.${
|
||||
selection === "create" ? "create" : "install"
|
||||
}`;
|
||||
},
|
||||
|
||||
@computed("privateChecked", "checkPrivate", "publicKey")
|
||||
@discourseComputed("privateChecked", "checkPrivate", "publicKey")
|
||||
showPublicKey(privateChecked, checkPrivate, publicKey) {
|
||||
return privateChecked && checkPrivate && publicKey;
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import PenaltyController from "admin/mixins/penalty-controller";
|
||||
|
||||
export default Controller.extend(PenaltyController, {
|
||||
|
@ -12,7 +12,7 @@ export default Controller.extend(PenaltyController, {
|
|||
this.setProperties({ silenceUntil: null, silencing: false });
|
||||
},
|
||||
|
||||
@computed("silenceUntil", "reason", "silencing")
|
||||
@discourseComputed("silenceUntil", "reason", "silencing")
|
||||
submitDisabled(silenceUntil, reason, silencing) {
|
||||
return silencing || isEmpty(silenceUntil) || !reason || reason.length < 1;
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import PenaltyController from "admin/mixins/penalty-controller";
|
||||
|
||||
export default Controller.extend(PenaltyController, {
|
||||
|
@ -12,7 +12,7 @@ export default Controller.extend(PenaltyController, {
|
|||
this.setProperties({ suspendUntil: null, suspending: false });
|
||||
},
|
||||
|
||||
@computed("suspendUntil", "reason", "suspending")
|
||||
@discourseComputed("suspendUntil", "reason", "suspending")
|
||||
submitDisabled(suspendUntil, reason, suspending) {
|
||||
return suspending || isEmpty(suspendUntil) || !reason || reason.length < 1;
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Controller from "@ember/controller";
|
||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||
import { on, observes } from "discourse-common/utils/decorators";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
@computed("value", "model.compiledRegularExpression")
|
||||
@discourseComputed("value", "model.compiledRegularExpression")
|
||||
matches(value, regexpString) {
|
||||
if (!value || !regexpString) return;
|
||||
let censorRegexp = new RegExp(regexpString, "ig");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
||||
export default Mixin.create({
|
||||
|
@ -12,7 +12,7 @@ export default Mixin.create({
|
|||
this.availablePeriods = ["yearly", "quarterly", "monthly", "weekly"];
|
||||
},
|
||||
|
||||
@computed("period")
|
||||
@discourseComputed("period")
|
||||
startDate(period) {
|
||||
let fullDay = moment()
|
||||
.locale("en")
|
||||
|
@ -37,7 +37,7 @@ export default Mixin.create({
|
|||
}
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
lastWeek() {
|
||||
return moment()
|
||||
.locale("en")
|
||||
|
@ -46,7 +46,7 @@ export default Mixin.create({
|
|||
.subtract(1, "week");
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
lastMonth() {
|
||||
return moment()
|
||||
.locale("en")
|
||||
|
@ -55,7 +55,7 @@ export default Mixin.create({
|
|||
.subtract(1, "month");
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
endDate() {
|
||||
return moment()
|
||||
.locale("en")
|
||||
|
@ -64,7 +64,7 @@ export default Mixin.create({
|
|||
.endOf("day");
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
today() {
|
||||
return moment()
|
||||
.locale("en")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias, oneWay } from "@ember/object/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { categoryLinkHTML } from "discourse/helpers/category-link";
|
||||
import { on } from "@ember/object/evented";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
@ -32,7 +32,7 @@ export default Mixin.create({
|
|||
validationMessage: null,
|
||||
isSecret: oneWay("setting.secret"),
|
||||
|
||||
@computed("buffered.value", "setting.value")
|
||||
@discourseComputed("buffered.value", "setting.value")
|
||||
dirty(bufferVal, settingVal) {
|
||||
if (bufferVal === null || bufferVal === undefined) bufferVal = "";
|
||||
if (settingVal === null || settingVal === undefined) settingVal = "";
|
||||
|
@ -40,7 +40,7 @@ export default Mixin.create({
|
|||
return bufferVal.toString() !== settingVal.toString();
|
||||
},
|
||||
|
||||
@computed("setting", "buffered.value")
|
||||
@discourseComputed("setting", "buffered.value")
|
||||
preview(setting, value) {
|
||||
// A bit hacky, but allows us to use helpers
|
||||
if (setting.get("setting") === "category_style") {
|
||||
|
@ -62,22 +62,22 @@ export default Mixin.create({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("componentType")
|
||||
@discourseComputed("componentType")
|
||||
typeClass(componentType) {
|
||||
return componentType.replace(/\_/g, "-");
|
||||
},
|
||||
|
||||
@computed("setting.setting")
|
||||
@discourseComputed("setting.setting")
|
||||
settingName(setting) {
|
||||
return setting.replace(/\_/g, " ");
|
||||
},
|
||||
|
||||
@computed("type")
|
||||
@discourseComputed("type")
|
||||
componentType(type) {
|
||||
return CUSTOM_TYPES.indexOf(type) !== -1 ? type : "string";
|
||||
},
|
||||
|
||||
@computed("setting")
|
||||
@discourseComputed("setting")
|
||||
type(setting) {
|
||||
if (setting.type === "list" && setting.list_type) {
|
||||
return `${setting.list_type}_list`;
|
||||
|
@ -86,12 +86,12 @@ export default Mixin.create({
|
|||
return setting.type;
|
||||
},
|
||||
|
||||
@computed("typeClass")
|
||||
@discourseComputed("typeClass")
|
||||
componentName(typeClass) {
|
||||
return "site-settings/" + typeClass;
|
||||
},
|
||||
|
||||
@computed("setting.default", "buffered.value")
|
||||
@discourseComputed("setting.default", "buffered.value")
|
||||
overridden(settingDefault, bufferedValue) {
|
||||
return settingDefault !== bufferedValue;
|
||||
},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
||||
export default Mixin.create({
|
||||
@computed("value", "default")
|
||||
@discourseComputed("value", "default")
|
||||
overridden(val, defaultVal) {
|
||||
if (val === null) val = "";
|
||||
if (defaultVal === null) defaultVal = "";
|
||||
|
@ -10,7 +10,7 @@ export default Mixin.create({
|
|||
return val.toString() !== defaultVal.toString();
|
||||
},
|
||||
|
||||
@computed("valid_values")
|
||||
@discourseComputed("valid_values")
|
||||
validValues(validValues) {
|
||||
const vals = [],
|
||||
translateNames = this.translate_names;
|
||||
|
@ -25,7 +25,7 @@ export default Mixin.create({
|
|||
return vals;
|
||||
},
|
||||
|
||||
@computed("valid_values")
|
||||
@discourseComputed("valid_values")
|
||||
allowsNone(validValues) {
|
||||
if (validValues && validValues.indexOf("") >= 0) {
|
||||
return "admin.settings.none";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { filter, or, gt, lt, not } from "@ember/object/computed";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { propertyNotEqual } from "discourse/lib/computed";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import Group from "discourse/models/group";
|
||||
|
@ -17,7 +17,7 @@ const AdminUser = Discourse.User.extend({
|
|||
|
||||
canViewProfile: or("active", "staged"),
|
||||
|
||||
@computed("bounce_score", "reset_bounce_score_after")
|
||||
@discourseComputed("bounce_score", "reset_bounce_score_after")
|
||||
bounceScore(bounce_score, reset_bounce_score_after) {
|
||||
if (bounce_score > 0) {
|
||||
return `${bounce_score} - ${moment(reset_bounce_score_after).format(
|
||||
|
@ -28,7 +28,7 @@ const AdminUser = Discourse.User.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("bounce_score")
|
||||
@discourseComputed("bounce_score")
|
||||
bounceScoreExplanation(bounce_score) {
|
||||
if (bounce_score === 0) {
|
||||
return I18n.t("admin.user.bounce_score_explanation.none");
|
||||
|
@ -39,7 +39,7 @@ const AdminUser = Discourse.User.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
bounceLink() {
|
||||
return Discourse.getURL("/admin/email/bounced");
|
||||
},
|
||||
|
@ -278,7 +278,7 @@ const AdminUser = Discourse.User.extend({
|
|||
|
||||
canSuspend: not("staff"),
|
||||
|
||||
@computed("suspended_till", "suspended_at")
|
||||
@discourseComputed("suspended_till", "suspended_at")
|
||||
suspendDuration(suspendedTill, suspendedAt) {
|
||||
suspendedAt = moment(suspendedAt);
|
||||
suspendedTill = moment(suspendedTill);
|
||||
|
@ -513,20 +513,20 @@ const AdminUser = Discourse.User.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@computed("tl3_requirements")
|
||||
@discourseComputed("tl3_requirements")
|
||||
tl3Requirements(requirements) {
|
||||
if (requirements) {
|
||||
return this.store.createRecord("tl3Requirements", requirements);
|
||||
}
|
||||
},
|
||||
|
||||
@computed("suspended_by")
|
||||
@discourseComputed("suspended_by")
|
||||
suspendedBy: wrapAdmin,
|
||||
|
||||
@computed("silenced_by")
|
||||
@discourseComputed("silenced_by")
|
||||
silencedBy: wrapAdmin,
|
||||
|
||||
@computed("approved_by")
|
||||
@discourseComputed("approved_by")
|
||||
approvedBy: wrapAdmin,
|
||||
|
||||
_formatError(event) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const ApiKey = RestModel.extend({
|
||||
user: Ember.computed("_user", {
|
||||
|
@ -18,12 +18,12 @@ const ApiKey = RestModel.extend({
|
|||
}
|
||||
}),
|
||||
|
||||
@computed("key")
|
||||
@discourseComputed("key")
|
||||
shortKey(key) {
|
||||
return `${key.substring(0, 4)}...`;
|
||||
},
|
||||
|
||||
@computed("description")
|
||||
@discourseComputed("description")
|
||||
shortDescription(description) {
|
||||
if (!description || description.length < 40) return description;
|
||||
return `${description.substring(0, 40)}...`;
|
||||
|
@ -45,7 +45,7 @@ const ApiKey = RestModel.extend({
|
|||
return this.getProperties("description", "username");
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
basePath() {
|
||||
return this.store
|
||||
.adapterFor("api-key")
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { not } from "@ember/object/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Discourse.Model.extend({
|
||||
restoreDisabled: not("restoreEnabled"),
|
||||
|
||||
@computed("allowRestore", "isOperationRunning")
|
||||
@discourseComputed("allowRestore", "isOperationRunning")
|
||||
restoreEnabled(allowRestore, isOperationRunning) {
|
||||
return allowRestore && !isOperationRunning;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes,
|
||||
on
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { propertyNotEqual } from "discourse/lib/computed";
|
||||
|
||||
const ColorSchemeColor = Discourse.Model.extend({
|
||||
|
@ -15,7 +15,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
|||
},
|
||||
|
||||
// Whether value has changed since it was last saved.
|
||||
@computed("hex")
|
||||
@discourseComputed("hex")
|
||||
changed(hex) {
|
||||
if (!this.originals) return false;
|
||||
if (hex !== this.originals.hex) return true;
|
||||
|
@ -27,7 +27,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
|||
overridden: propertyNotEqual("hex", "default_hex"),
|
||||
|
||||
// Whether the saved value is different than Discourse's default color scheme.
|
||||
@computed("default_hex", "hex")
|
||||
@discourseComputed("default_hex", "hex")
|
||||
savedIsOverriden(defaultHex) {
|
||||
return this.originals.hex !== defaultHex;
|
||||
},
|
||||
|
@ -42,7 +42,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("name")
|
||||
@discourseComputed("name")
|
||||
translatedName(name) {
|
||||
if (!this.is_advanced) {
|
||||
return I18n.t(`admin.customize.colors.${name}.name`);
|
||||
|
@ -51,7 +51,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("name")
|
||||
@discourseComputed("name")
|
||||
description(name) {
|
||||
if (!this.is_advanced) {
|
||||
return I18n.t(`admin.customize.colors.${name}.description`);
|
||||
|
@ -66,7 +66,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
|||
|
||||
@property brightness
|
||||
**/
|
||||
@computed("hex")
|
||||
@discourseComputed("hex")
|
||||
brightness(hex) {
|
||||
if (hex.length === 6 || hex.length === 3) {
|
||||
if (hex.length === 3) {
|
||||
|
@ -94,7 +94,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("hex")
|
||||
@discourseComputed("hex")
|
||||
valid(hex) {
|
||||
return hex.match(/^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/) !== null;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { not } from "@ember/object/computed";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import ColorSchemeColor from "admin/models/color-scheme-color";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
|
||||
init() {
|
||||
|
@ -10,7 +10,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
|
|||
this.startTrackingChanges();
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
description() {
|
||||
return "" + this.name;
|
||||
},
|
||||
|
@ -42,7 +42,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
|
|||
return newScheme;
|
||||
},
|
||||
|
||||
@computed("name", "colors.@each.changed", "saving")
|
||||
@discourseComputed("name", "colors.@each.changed", "saving")
|
||||
changed(name) {
|
||||
if (!this.originals) return false;
|
||||
if (this.originals.name !== name) return true;
|
||||
|
@ -51,7 +51,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
|
|||
return false;
|
||||
},
|
||||
|
||||
@computed("changed")
|
||||
@discourseComputed("changed")
|
||||
disableSave(changed) {
|
||||
if (this.theme_id) {
|
||||
return false;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default RestModel.extend({
|
||||
@computed("id")
|
||||
@discourseComputed("id")
|
||||
name(id) {
|
||||
return I18n.t(`admin.flags.summary.action_type_${id}`, { count: 1 });
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import EmberObject from "@ember/object";
|
||||
|
@ -9,7 +10,6 @@ import {
|
|||
formatUsername,
|
||||
toNumber
|
||||
} from "discourse/lib/utilities";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { number, durationTiny } from "discourse/lib/formatter";
|
||||
import { renderAvatar } from "discourse/helpers/user-avatar";
|
||||
|
||||
|
@ -22,12 +22,12 @@ const Report = Discourse.Model.extend({
|
|||
percent: false,
|
||||
higher_is_better: true,
|
||||
|
||||
@computed("modes")
|
||||
@discourseComputed("modes")
|
||||
isTable(modes) {
|
||||
return modes.some(mode => mode === "table");
|
||||
},
|
||||
|
||||
@computed("type", "start_date", "end_date")
|
||||
@discourseComputed("type", "start_date", "end_date")
|
||||
reportUrl(type, start_date, end_date) {
|
||||
start_date = moment
|
||||
.utc(start_date)
|
||||
|
@ -83,32 +83,32 @@ const Report = Discourse.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("data", "average")
|
||||
@discourseComputed("data", "average")
|
||||
todayCount() {
|
||||
return this.valueAt(0);
|
||||
},
|
||||
|
||||
@computed("data", "average")
|
||||
@discourseComputed("data", "average")
|
||||
yesterdayCount() {
|
||||
return this.valueAt(1);
|
||||
},
|
||||
|
||||
@computed("data", "average")
|
||||
@discourseComputed("data", "average")
|
||||
sevenDaysAgoCount() {
|
||||
return this.valueAt(7);
|
||||
},
|
||||
|
||||
@computed("data", "average")
|
||||
@discourseComputed("data", "average")
|
||||
thirtyDaysAgoCount() {
|
||||
return this.valueAt(30);
|
||||
},
|
||||
|
||||
@computed("data", "average")
|
||||
@discourseComputed("data", "average")
|
||||
lastSevenDaysCount() {
|
||||
return this.averageCount(7, this.valueFor(1, 7));
|
||||
},
|
||||
|
||||
@computed("data", "average")
|
||||
@discourseComputed("data", "average")
|
||||
lastThirtyDaysCount() {
|
||||
return this.averageCount(30, this.valueFor(1, 30));
|
||||
},
|
||||
|
@ -117,12 +117,12 @@ const Report = Discourse.Model.extend({
|
|||
return this.average ? value / count : value;
|
||||
},
|
||||
|
||||
@computed("yesterdayCount", "higher_is_better")
|
||||
@discourseComputed("yesterdayCount", "higher_is_better")
|
||||
yesterdayTrend(yesterdayCount, higherIsBetter) {
|
||||
return this._computeTrend(this.valueAt(2), yesterdayCount, higherIsBetter);
|
||||
},
|
||||
|
||||
@computed("lastSevenDaysCount", "higher_is_better")
|
||||
@discourseComputed("lastSevenDaysCount", "higher_is_better")
|
||||
sevenDaysTrend(lastSevenDaysCount, higherIsBetter) {
|
||||
return this._computeTrend(
|
||||
this.valueFor(8, 14),
|
||||
|
@ -131,50 +131,55 @@ const Report = Discourse.Model.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@computed("data")
|
||||
@discourseComputed("data")
|
||||
currentTotal(data) {
|
||||
return data.reduce((cur, pair) => cur + pair.y, 0);
|
||||
},
|
||||
|
||||
@computed("data", "currentTotal")
|
||||
@discourseComputed("data", "currentTotal")
|
||||
currentAverage(data, total) {
|
||||
return makeArray(data).length === 0
|
||||
? 0
|
||||
: parseFloat((total / parseFloat(data.length)).toFixed(1));
|
||||
},
|
||||
|
||||
@computed("trend", "higher_is_better")
|
||||
@discourseComputed("trend", "higher_is_better")
|
||||
trendIcon(trend, higherIsBetter) {
|
||||
return this._iconForTrend(trend, higherIsBetter);
|
||||
},
|
||||
|
||||
@computed("sevenDaysTrend", "higher_is_better")
|
||||
@discourseComputed("sevenDaysTrend", "higher_is_better")
|
||||
sevenDaysTrendIcon(sevenDaysTrend, higherIsBetter) {
|
||||
return this._iconForTrend(sevenDaysTrend, higherIsBetter);
|
||||
},
|
||||
|
||||
@computed("thirtyDaysTrend", "higher_is_better")
|
||||
@discourseComputed("thirtyDaysTrend", "higher_is_better")
|
||||
thirtyDaysTrendIcon(thirtyDaysTrend, higherIsBetter) {
|
||||
return this._iconForTrend(thirtyDaysTrend, higherIsBetter);
|
||||
},
|
||||
|
||||
@computed("yesterdayTrend", "higher_is_better")
|
||||
@discourseComputed("yesterdayTrend", "higher_is_better")
|
||||
yesterdayTrendIcon(yesterdayTrend, higherIsBetter) {
|
||||
return this._iconForTrend(yesterdayTrend, higherIsBetter);
|
||||
},
|
||||
|
||||
@computed("prev_period", "currentTotal", "currentAverage", "higher_is_better")
|
||||
@discourseComputed(
|
||||
"prev_period",
|
||||
"currentTotal",
|
||||
"currentAverage",
|
||||
"higher_is_better"
|
||||
)
|
||||
trend(prev, currentTotal, currentAverage, higherIsBetter) {
|
||||
const total = this.average ? currentAverage : currentTotal;
|
||||
return this._computeTrend(prev, total, higherIsBetter);
|
||||
},
|
||||
|
||||
@computed("prev30Days", "lastThirtyDaysCount", "higher_is_better")
|
||||
@discourseComputed("prev30Days", "lastThirtyDaysCount", "higher_is_better")
|
||||
thirtyDaysTrend(prev30Days, lastThirtyDaysCount, higherIsBetter) {
|
||||
return this._computeTrend(prev30Days, lastThirtyDaysCount, higherIsBetter);
|
||||
},
|
||||
|
||||
@computed("type")
|
||||
@discourseComputed("type")
|
||||
method(type) {
|
||||
if (type === "time_to_first_response") {
|
||||
return "average";
|
||||
|
@ -195,7 +200,7 @@ const Report = Discourse.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("prev_period", "currentTotal", "currentAverage")
|
||||
@discourseComputed("prev_period", "currentTotal", "currentAverage")
|
||||
trendTitle(prev, currentTotal, currentAverage) {
|
||||
let current = this.average ? currentAverage : currentTotal;
|
||||
let percent = this.percentChangeString(prev, current);
|
||||
|
@ -228,12 +233,12 @@ const Report = Discourse.Model.extend({
|
|||
return title;
|
||||
},
|
||||
|
||||
@computed("yesterdayCount")
|
||||
@discourseComputed("yesterdayCount")
|
||||
yesterdayCountTitle(yesterdayCount) {
|
||||
return this.changeTitle(this.valueAt(2), yesterdayCount, "two days ago");
|
||||
},
|
||||
|
||||
@computed("lastSevenDaysCount")
|
||||
@discourseComputed("lastSevenDaysCount")
|
||||
sevenDaysCountTitle(lastSevenDaysCount) {
|
||||
return this.changeTitle(
|
||||
this.valueFor(8, 14),
|
||||
|
@ -242,7 +247,7 @@ const Report = Discourse.Model.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@computed("prev30Days", "lastThirtyDaysCount")
|
||||
@discourseComputed("prev30Days", "lastThirtyDaysCount")
|
||||
thirtyDaysCountTitle(prev30Days, lastThirtyDaysCount) {
|
||||
return this.changeTitle(
|
||||
prev30Days,
|
||||
|
@ -251,18 +256,18 @@ const Report = Discourse.Model.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@computed("data")
|
||||
@discourseComputed("data")
|
||||
sortedData(data) {
|
||||
return this.xAxisIsDate ? data.toArray().reverse() : data.toArray();
|
||||
},
|
||||
|
||||
@computed("data")
|
||||
@discourseComputed("data")
|
||||
xAxisIsDate() {
|
||||
if (!this.data[0]) return false;
|
||||
return this.data && this.data[0].x.match(/\d{4}-\d{1,2}-\d{1,2}/);
|
||||
},
|
||||
|
||||
@computed("labels")
|
||||
@discourseComputed("labels")
|
||||
computedLabels(labels) {
|
||||
return labels.map(label => {
|
||||
const type = label.type || "string";
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const ScreenedEmail = Discourse.Model.extend({
|
||||
@computed("action")
|
||||
@discourseComputed("action")
|
||||
actionName(action) {
|
||||
return I18n.t("admin.logs.screened_actions." + action);
|
||||
},
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { equal } from "@ember/object/computed";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const ScreenedIpAddress = Discourse.Model.extend({
|
||||
@computed("action_name")
|
||||
@discourseComputed("action_name")
|
||||
actionName(actionName) {
|
||||
return I18n.t(`admin.logs.screened_ips.actions.${actionName}`);
|
||||
},
|
||||
|
||||
isBlocked: equal("action_name", "block"),
|
||||
|
||||
@computed("ip_address")
|
||||
@discourseComputed("ip_address")
|
||||
isRange(ipAddress) {
|
||||
return ipAddress.indexOf("/") > 0;
|
||||
},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const ScreenedUrl = Discourse.Model.extend({
|
||||
@computed("action")
|
||||
@discourseComputed("action")
|
||||
actionName(action) {
|
||||
return I18n.t("admin.logs.screened_actions." + action);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
|
@ -13,12 +13,12 @@ function format(label, value, escape = true) {
|
|||
const StaffActionLog = RestModel.extend({
|
||||
showFullDetails: false,
|
||||
|
||||
@computed("action_name")
|
||||
@discourseComputed("action_name")
|
||||
actionName(actionName) {
|
||||
return I18n.t(`admin.logs.staff_actions.actions.${actionName}`);
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"email",
|
||||
"ip_address",
|
||||
"topic_id",
|
||||
|
@ -69,12 +69,12 @@ const StaffActionLog = RestModel.extend({
|
|||
return formatted.length > 0 ? formatted + "<br/>" : "";
|
||||
},
|
||||
|
||||
@computed("details")
|
||||
@discourseComputed("details")
|
||||
useModalForDetails(details) {
|
||||
return details && details.length > 100;
|
||||
},
|
||||
|
||||
@computed("action_name")
|
||||
@discourseComputed("action_name")
|
||||
useCustomModalForDetails(actionName) {
|
||||
return ["change_theme", "delete_theme"].includes(actionName);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { get } from "@ember/object";
|
|||
import { isEmpty } from "@ember/utils";
|
||||
import { or, gt } from "@ember/object/computed";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
|
@ -20,7 +20,7 @@ const Theme = RestModel.extend({
|
|||
isPendingUpdates: gt("remote_theme.commits_behind", 0),
|
||||
hasEditedFields: gt("editedFields.length", 0),
|
||||
|
||||
@computed("theme_fields.[]")
|
||||
@discourseComputed("theme_fields.[]")
|
||||
targets() {
|
||||
return [
|
||||
{ id: 0, name: "common" },
|
||||
|
@ -48,7 +48,7 @@ const Theme = RestModel.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@computed("theme_fields.[]")
|
||||
@discourseComputed("theme_fields.[]")
|
||||
fieldNames() {
|
||||
const common = [
|
||||
"scss",
|
||||
|
@ -82,7 +82,11 @@ const Theme = RestModel.extend({
|
|||
};
|
||||
},
|
||||
|
||||
@computed("fieldNames", "theme_fields.[]", "theme_fields.@each.error")
|
||||
@discourseComputed(
|
||||
"fieldNames",
|
||||
"theme_fields.[]",
|
||||
"theme_fields.@each.error"
|
||||
)
|
||||
fields(fieldNames) {
|
||||
const hash = {};
|
||||
Object.keys(fieldNames).forEach(target => {
|
||||
|
@ -112,7 +116,7 @@ const Theme = RestModel.extend({
|
|||
return hash;
|
||||
},
|
||||
|
||||
@computed("theme_fields")
|
||||
@discourseComputed("theme_fields")
|
||||
themeFields(fields) {
|
||||
if (!fields) {
|
||||
this.set("theme_fields", []);
|
||||
|
@ -128,7 +132,7 @@ const Theme = RestModel.extend({
|
|||
return hash;
|
||||
},
|
||||
|
||||
@computed("theme_fields", "theme_fields.[]")
|
||||
@discourseComputed("theme_fields", "theme_fields.[]")
|
||||
uploads(fields) {
|
||||
if (!fields) {
|
||||
return [];
|
||||
|
@ -138,19 +142,19 @@ const Theme = RestModel.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@computed("theme_fields", "theme_fields.@each.error")
|
||||
@discourseComputed("theme_fields", "theme_fields.@each.error")
|
||||
isBroken(fields) {
|
||||
return fields && fields.any(field => field.error && field.error.length > 0);
|
||||
},
|
||||
|
||||
@computed("theme_fields.[]")
|
||||
@discourseComputed("theme_fields.[]")
|
||||
editedFields(fields) {
|
||||
return fields.filter(
|
||||
field => !Ember.isBlank(field.value) && field.type_id !== SETTINGS_TYPE_ID
|
||||
);
|
||||
},
|
||||
|
||||
@computed("remote_theme.last_error_text")
|
||||
@discourseComputed("remote_theme.last_error_text")
|
||||
remoteError(errorText) {
|
||||
if (errorText && errorText.length > 0) {
|
||||
return errorText;
|
||||
|
@ -241,7 +245,7 @@ const Theme = RestModel.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("childThemes.[]")
|
||||
@discourseComputed("childThemes.[]")
|
||||
child_theme_ids(childThemes) {
|
||||
if (childThemes) {
|
||||
return childThemes.map(theme => get(theme, "id"));
|
||||
|
@ -265,7 +269,7 @@ const Theme = RestModel.extend({
|
|||
return this.saveChanges("child_theme_ids");
|
||||
},
|
||||
|
||||
@computed("name", "default")
|
||||
@discourseComputed("name", "default")
|
||||
description: function(name, isDefault) {
|
||||
if (isDefault) {
|
||||
return I18n.t("admin.customize.theme.default_name", { name: name });
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
export default Discourse.Model.extend({
|
||||
@computed("days_visited", "time_period")
|
||||
@discourseComputed("days_visited", "time_period")
|
||||
days_visited_percent(daysVisited, timePeriod) {
|
||||
return Math.round((daysVisited * 100) / timePeriod);
|
||||
},
|
||||
|
||||
@computed("min_days_visited", "time_period")
|
||||
@discourseComputed("min_days_visited", "time_period")
|
||||
min_days_visited_percent(minDaysVisited, timePeriod) {
|
||||
return Math.round((minDaysVisited * 100) / timePeriod);
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"days_visited",
|
||||
"min_days_visited",
|
||||
"num_topics_replied_to",
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const VersionCheck = Discourse.Model.extend({
|
||||
@computed("updated_at")
|
||||
@discourseComputed("updated_at")
|
||||
noCheckPerformed(updatedAt) {
|
||||
return updatedAt === null;
|
||||
},
|
||||
|
||||
@computed("missing_versions_count")
|
||||
@discourseComputed("missing_versions_count")
|
||||
upToDate(missingVersionsCount) {
|
||||
return missingVersionsCount === 0 || missingVersionsCount === null;
|
||||
},
|
||||
|
||||
@computed("missing_versions_count")
|
||||
@discourseComputed("missing_versions_count")
|
||||
behindByOneVersion(missingVersionsCount) {
|
||||
return missingVersionsCount === 1;
|
||||
},
|
||||
|
||||
@computed("installed_sha")
|
||||
@discourseComputed("installed_sha")
|
||||
gitLink(installedSHA) {
|
||||
if (installedSHA) {
|
||||
return `https://github.com/discourse/discourse/commits/${installedSHA}`;
|
||||
}
|
||||
},
|
||||
|
||||
@computed("installed_sha")
|
||||
@discourseComputed("installed_sha")
|
||||
shortSha(installedSHA) {
|
||||
if (installedSHA) {
|
||||
return installedSHA.substr(0, 10);
|
||||
|
|
|
@ -3,9 +3,9 @@ import RestModel from "discourse/models/rest";
|
|||
import Category from "discourse/models/category";
|
||||
import Group from "discourse/models/group";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default RestModel.extend({
|
||||
content_type: 1, // json
|
||||
|
@ -16,7 +16,7 @@ export default RestModel.extend({
|
|||
web_hook_event_types: null,
|
||||
groupsFilterInName: null,
|
||||
|
||||
@computed("wildcard_web_hook")
|
||||
@discourseComputed("wildcard_web_hook")
|
||||
webHookType: {
|
||||
get(wildcard) {
|
||||
return wildcard ? "wildcard" : "individual";
|
||||
|
@ -26,7 +26,7 @@ export default RestModel.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("category_ids")
|
||||
@discourseComputed("category_ids")
|
||||
categories(categoryIds) {
|
||||
return Category.findByIds(categoryIds);
|
||||
},
|
||||
|
@ -49,7 +49,7 @@ export default RestModel.extend({
|
|||
return Group.findAll({ term: term, ignore_automatic: false });
|
||||
},
|
||||
|
||||
@computed("wildcard_web_hook", "web_hook_event_types.[]")
|
||||
@discourseComputed("wildcard_web_hook", "web_hook_event_types.[]")
|
||||
description(isWildcardWebHook, types) {
|
||||
let desc = "";
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
//= require_tree ./ember-addons/utils
|
||||
//= require_tree ./discourse-common
|
||||
//= require ./ember-addons/decorator-alias
|
||||
//= require ./ember-addons/macro-alias
|
||||
//= require ./ember-addons/ember-computed-decorators
|
||||
//= require ./ember-addons/fmt
|
||||
//= require ./polyfills
|
||||
//= require_tree ./discourse-common
|
||||
//= require_tree ./select-kit
|
||||
//= require ./discourse
|
||||
//= require ./deprecated
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This is a mechanism for quickly rendering templates which is Ember aware
|
||||
// templates are highly compatible with Ember so you don't need to worry about calling "get"
|
||||
// and computed properties function, additionally it uses stringParams like Ember does
|
||||
// and discourseComputed properties function, additionally it uses stringParams like Ember does
|
||||
|
||||
const RawHandlebars = Handlebars.create();
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import handleDescriptor from "./utils/handle-descriptor";
|
||||
import isDescriptor from "./utils/is-descriptor";
|
||||
import extractValue from "./utils/extract-value";
|
||||
import handleDescriptor from "ember-addons/utils/handle-descriptor";
|
||||
import isDescriptor from "ember-addons/utils/is-descriptor";
|
||||
import extractValue from "ember-addons/utils/extract-value";
|
||||
|
||||
export default function computedDecorator(...params) {
|
||||
// determine if user called as @computed('blah', 'blah') or @computed
|
||||
export default function discourseComputedDecorator(...params) {
|
||||
// determine if user called as @discourseComputed('blah', 'blah') or @discourseComputed
|
||||
if (isDescriptor(params[params.length - 1])) {
|
||||
return handleDescriptor(...arguments);
|
||||
} else {
|
||||
|
@ -25,7 +25,7 @@ export function readOnly(target, name, desc) {
|
|||
};
|
||||
}
|
||||
|
||||
import decoratorAlias from "./decorator-alias";
|
||||
import decoratorAlias from "ember-addons/decorator-alias";
|
||||
|
||||
export var on = decoratorAlias(Ember.on, "Can not `on` without event names");
|
||||
export var observes = decoratorAlias(
|
||||
|
@ -33,7 +33,7 @@ export var observes = decoratorAlias(
|
|||
"Can not `observe` without property names"
|
||||
);
|
||||
|
||||
import macroAlias from "./macro-alias";
|
||||
import macroAlias from "ember-addons/macro-alias";
|
||||
|
||||
export var alias = macroAlias(Ember.computed.alias);
|
||||
export var and = macroAlias(Ember.computed.and);
|
|
@ -3,6 +3,10 @@ var define, requirejs;
|
|||
(function() {
|
||||
// In future versions of ember we don't need this
|
||||
var EMBER_MODULES = {};
|
||||
var ALIASES = {
|
||||
"ember-addons/ember-computed-decorators":
|
||||
"discourse-common/utils/decorators"
|
||||
};
|
||||
if (typeof Ember !== "undefined") {
|
||||
EMBER_MODULES = {
|
||||
jquery: { default: $ },
|
||||
|
@ -76,7 +80,7 @@ var define, requirejs;
|
|||
"@ember/utils": {
|
||||
isEmpty: Ember.isEmpty
|
||||
},
|
||||
"rsvp": {
|
||||
rsvp: {
|
||||
Promise: Ember.RSVP.Promise,
|
||||
hash: Ember.RSVP.hash,
|
||||
all: Ember.RSVP.all
|
||||
|
@ -213,6 +217,7 @@ var define, requirejs;
|
|||
}
|
||||
|
||||
function requireFrom(name, origin) {
|
||||
name = checkForAlias(name);
|
||||
var mod = EMBER_MODULES[name] || registry[name];
|
||||
if (!mod) {
|
||||
throw new Error(
|
||||
|
@ -226,6 +231,10 @@ var define, requirejs;
|
|||
throw new Error("Could not find module " + name);
|
||||
}
|
||||
|
||||
function checkForAlias(name) {
|
||||
return ALIASES[name] ? ALIASES[name] : name;
|
||||
}
|
||||
|
||||
requirejs = require = function(name) {
|
||||
if (EMBER_MODULES[name]) {
|
||||
return EMBER_MODULES[name];
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*global Mousetrap:true*/
|
||||
import { buildResolver } from "discourse-common/resolver";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
import FocusEvent from "discourse-common/mixins/focus-event";
|
||||
|
||||
const _pluginCallbacks = [];
|
||||
|
@ -66,7 +66,7 @@ const Discourse = Ember.Application.extend(FocusEvent, {
|
|||
document.title = title;
|
||||
},
|
||||
|
||||
@computed("contextCount", "notificationCount")
|
||||
@discourseComputed("contextCount", "notificationCount")
|
||||
displayCount() {
|
||||
return Discourse.User.current() &&
|
||||
Discourse.User.currentProp("title_count_mode") === "notifications"
|
||||
|
@ -179,7 +179,7 @@ const Discourse = Ember.Application.extend(FocusEvent, {
|
|||
});
|
||||
},
|
||||
|
||||
@computed("currentAssetVersion", "desiredAssetVersion")
|
||||
@discourseComputed("currentAssetVersion", "desiredAssetVersion")
|
||||
requiresRefresh(currentAssetVersion, desiredAssetVersion) {
|
||||
return desiredAssetVersion && currentAssetVersion !== desiredAssetVersion;
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
_slug: null,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
import MountWidget from "discourse/components/mount-widget";
|
||||
|
||||
export default MountWidget.extend({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import UploadMixin from "discourse/mixins/upload";
|
||||
|
||||
export default Component.extend(UploadMixin, {
|
||||
|
@ -21,7 +21,7 @@ export default Component.extend(UploadMixin, {
|
|||
this.done();
|
||||
},
|
||||
|
||||
@computed("user_id")
|
||||
@discourseComputed("user_id")
|
||||
data(user_id) {
|
||||
return { user_id };
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
|
||||
function b64EncodeUnicode(str) {
|
||||
|
@ -32,10 +32,10 @@ export default Component.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("formattedBackupCodes")
|
||||
@discourseComputed("formattedBackupCodes")
|
||||
base64BackupCode: b64EncodeUnicode,
|
||||
|
||||
@computed("backupCodes")
|
||||
@discourseComputed("backupCodes")
|
||||
formattedBackupCodes(backupCodes) {
|
||||
if (!backupCodes) return null;
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import UploadMixin from "discourse/mixins/upload";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export default Component.extend(UploadMixin, {
|
||||
tagName: "span",
|
||||
|
||||
@computed("uploading", "uploadProgress")
|
||||
@discourseComputed("uploading", "uploadProgress")
|
||||
uploadButtonText(uploading, progress) {
|
||||
return uploading
|
||||
? I18n.t("admin.backups.upload.uploading_progress", { progress })
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user