mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 10:33:51 +08:00
DEV: Clean up Ember imports (#8979)
Includes: * Import `computed` helpers * Import `@ember/application` * Import `isBlank` from `@ember/utils` * Import `A` from `@ember/array` * Import `EmberArray` from `@ember/array` * Import `ArrayProxy` from `@ember/array/proxy` * Import `warn` from `@ember/debug` * Import `EmberObject` from `@ember/object` * Import `Application` from `@ember/application` * Import `EmberRouter` from `@ember/routing/router` * Import `isPresent` from `@ember/utils` * Import `computed` from `@ember/object` * Import `guidFor` from `@ember/object` * Import `isArray` from `@ember/array` * Import `TextField` from `@ember/component` * Import `TextArea` from `@ember/component` * Import `Promise` from `rsvp` * Import `Evented` from `@ember/object/evented` * Replace deprecated `ember-addons/ember-computed-decorators` imports
This commit is contained in:
parent
26da99a2d2
commit
48ba65f406
|
@ -1,5 +1,6 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isBlank } from "@ember/utils";
|
||||
import Controller from "@ember/controller";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Controller.extend({
|
||||
|
@ -15,8 +16,8 @@ export default Controller.extend({
|
|||
|
||||
@discourseComputed("model.description", "model.username", "userMode")
|
||||
saveDisabled(description, username, userMode) {
|
||||
if (Ember.isBlank(description)) return true;
|
||||
if (userMode === "single" && Ember.isBlank(username)) return true;
|
||||
if (isBlank(description)) return true;
|
||||
if (userMode === "single" && isBlank(username)) return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import Controller from "@ember/controller";
|
||||
import { A } from "@ember/array";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
|
@ -7,7 +8,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
@observes("model")
|
||||
modelChanged() {
|
||||
const model = this.model;
|
||||
const copy = Ember.A();
|
||||
const copy = A();
|
||||
const store = this.store;
|
||||
|
||||
if (model) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { warn } from "@ember/debug";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias, oneWay } from "@ember/object/computed";
|
||||
import { categoryLinkHTML } from "discourse/helpers/category-link";
|
||||
|
@ -137,7 +138,7 @@ export default Mixin.create({
|
|||
}),
|
||||
|
||||
_save() {
|
||||
Ember.warn("You should define a `_save` method", {
|
||||
warn("You should define a `_save` method", {
|
||||
id: "discourse.setting-component.missing-save"
|
||||
});
|
||||
return Promise.resolve();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { A } from "@ember/array";
|
||||
import ArrayProxy from "@ember/array/proxy";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { not } from "@ember/object/computed";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
@ -33,7 +35,7 @@ const ColorScheme = EmberObject.extend({
|
|||
const newScheme = ColorScheme.create({
|
||||
name: this.name,
|
||||
can_edit: true,
|
||||
colors: Ember.A()
|
||||
colors: A()
|
||||
});
|
||||
this.colors.forEach(c => {
|
||||
newScheme.colors.pushObject(
|
||||
|
@ -111,7 +113,7 @@ const ColorScheme = EmberObject.extend({
|
|||
}
|
||||
});
|
||||
|
||||
const ColorSchemes = Ember.ArrayProxy.extend({});
|
||||
const ColorSchemes = ArrayProxy.extend({});
|
||||
|
||||
ColorScheme.reopenClass({
|
||||
findAll() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { get } from "@ember/object";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { isBlank, isEmpty } from "@ember/utils";
|
||||
import { or, gt } from "@ember/object/computed";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
@ -153,7 +153,7 @@ const Theme = RestModel.extend({
|
|||
@discourseComputed("theme_fields.[]")
|
||||
editedFields(fields) {
|
||||
return fields.filter(
|
||||
field => !Ember.isBlank(field.value) && field.type_id !== SETTINGS_TYPE_ID
|
||||
field => !isBlank(field.value) && field.type_id !== SETTINGS_TYPE_ID
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ var define, requirejs;
|
|||
jquery: { default: $ },
|
||||
"@ember/array": {
|
||||
default: Ember.Array,
|
||||
A: Ember.A
|
||||
A: Ember.A,
|
||||
isArray: Ember.isArray
|
||||
},
|
||||
"@ember/array/proxy": {
|
||||
default: Ember.ArrayProxy
|
||||
|
@ -99,10 +100,10 @@ var define, requirejs;
|
|||
inject: Ember.inject.service
|
||||
},
|
||||
"@ember/utils": {
|
||||
isPresent: Ember.isPresent,
|
||||
isBlank: Ember.isBlank,
|
||||
isEmpty: Ember.isEmpty,
|
||||
isNone: Ember.isNone
|
||||
isNone: Ember.isNone,
|
||||
isPresent: Ember.isPresent
|
||||
},
|
||||
rsvp: {
|
||||
default: Ember.RSVP,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*global Mousetrap:true*/
|
||||
import Application from "@ember/application";
|
||||
import EmberObject, { computed } from "@ember/object";
|
||||
import { buildResolver } from "discourse-common/resolver";
|
||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||
import { computed } from "@ember/object";
|
||||
import FocusEvent from "discourse-common/mixins/focus-event";
|
||||
import EmberObject from "@ember/object";
|
||||
import deprecated from "discourse-common/lib/deprecated";
|
||||
|
||||
const _pluginCallbacks = [];
|
||||
|
||||
const Discourse = Ember.Application.extend(FocusEvent, {
|
||||
const Discourse = Application.extend(FocusEvent, {
|
||||
rootElement: "#main",
|
||||
_docTitle: document.title,
|
||||
RAW_TEMPLATES: {},
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { TextArea } from "@ember/component";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { on, observes } from "discourse-common/utils/decorators";
|
||||
import autosize from "discourse/lib/autosize";
|
||||
|
||||
export default Ember.TextArea.extend({
|
||||
export default TextArea.extend({
|
||||
@on("didInsertElement")
|
||||
_startWatching() {
|
||||
scheduleOnce("afterRender", () => {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { TextField } from "@ember/component";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Ember.TextField.extend({
|
||||
export default TextField.extend({
|
||||
@on("init")
|
||||
_init() {
|
||||
// Chrome autocomplete is buggy per:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { TextField } from "@ember/component";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
export default Ember.TextField.extend({
|
||||
export default TextField.extend({
|
||||
classNameBindings: ["invalid"],
|
||||
|
||||
@discourseComputed("number")
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { TextField } from "@ember/component";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { siteDir, isRTL, isLTR } from "discourse/lib/text-direction";
|
||||
|
||||
export default Ember.TextField.extend({
|
||||
export default TextField.extend({
|
||||
attributeBindings: [
|
||||
"autocorrect",
|
||||
"autocapitalize",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { A } from "@ember/array";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { notEmpty, or, not } from "@ember/object/computed";
|
||||
import Controller, { inject as controller } from "@ember/controller";
|
||||
|
@ -31,7 +32,7 @@ export default Controller.extend(
|
|||
accountChallenge: 0,
|
||||
accountHoneypot: 0,
|
||||
formSubmitted: false,
|
||||
rejectedEmails: Ember.A([]),
|
||||
rejectedEmails: A(),
|
||||
prefilledUsername: null,
|
||||
userFields: null,
|
||||
isDeveloper: false,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
export default Ember.ArrayProxy.extend({
|
||||
import ArrayProxy from "@ember/array/proxy";
|
||||
|
||||
export default ArrayProxy.extend({
|
||||
render(topic, renderIcon) {
|
||||
const renderIconIf = (conditionProp, name, key) => {
|
||||
if (!topic.get(conditionProp)) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { computed } from "@ember/object";
|
||||
import addonFmt from "ember-addons/fmt";
|
||||
|
||||
/**
|
||||
|
@ -10,7 +11,7 @@ import addonFmt from "ember-addons/fmt";
|
|||
**/
|
||||
|
||||
export function propertyEqual(p1, p2) {
|
||||
return Ember.computed(p1, p2, function() {
|
||||
return computed(p1, p2, function() {
|
||||
return this.get(p1) === this.get(p2);
|
||||
});
|
||||
}
|
||||
|
@ -24,19 +25,19 @@ export function propertyEqual(p1, p2) {
|
|||
@return {Function} discourseComputedProperty function
|
||||
**/
|
||||
export function propertyNotEqual(p1, p2) {
|
||||
return Ember.computed(p1, p2, function() {
|
||||
return computed(p1, p2, function() {
|
||||
return this.get(p1) !== this.get(p2);
|
||||
});
|
||||
}
|
||||
|
||||
export function propertyGreaterThan(p1, p2) {
|
||||
return Ember.computed(p1, p2, function() {
|
||||
return computed(p1, p2, function() {
|
||||
return this.get(p1) > this.get(p2);
|
||||
});
|
||||
}
|
||||
|
||||
export function propertyLessThan(p1, p2) {
|
||||
return Ember.computed(p1, p2, function() {
|
||||
return computed(p1, p2, function() {
|
||||
return this.get(p1) < this.get(p2);
|
||||
});
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ export function propertyLessThan(p1, p2) {
|
|||
**/
|
||||
export function i18n(...args) {
|
||||
const format = args.pop();
|
||||
return Ember.computed(...args, function() {
|
||||
return computed(...args, function() {
|
||||
return I18n.t(addonFmt(format, ...args.map(a => this.get(a))));
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ export function i18n(...args) {
|
|||
**/
|
||||
export function fmt(...args) {
|
||||
const format = args.pop();
|
||||
return Ember.computed(...args, function() {
|
||||
return computed(...args, function() {
|
||||
return addonFmt(format, ...args.map(a => this.get(a)));
|
||||
});
|
||||
}
|
||||
|
@ -83,7 +84,7 @@ export function fmt(...args) {
|
|||
**/
|
||||
export function url(...args) {
|
||||
const format = args.pop();
|
||||
return Ember.computed(...args, function() {
|
||||
return computed(...args, function() {
|
||||
return Discourse.getURL(addonFmt(format, ...args.map(a => this.get(a))));
|
||||
});
|
||||
}
|
||||
|
@ -99,7 +100,7 @@ export function url(...args) {
|
|||
export function endWith() {
|
||||
const args = Array.prototype.slice.call(arguments, 0);
|
||||
const substring = args.pop();
|
||||
return Ember.computed(...args, function() {
|
||||
return computed(...args, function() {
|
||||
return args
|
||||
.map(a => this.get(a))
|
||||
.every(s => {
|
||||
|
@ -118,7 +119,7 @@ export function endWith() {
|
|||
@param {String} name of site setting
|
||||
**/
|
||||
export function setting(name) {
|
||||
return Ember.computed(function() {
|
||||
return computed(function() {
|
||||
return Discourse.SiteSettings[name];
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberArray from "@ember/array";
|
||||
import EmberObject from "@ember/object";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
|
@ -5,7 +6,7 @@ export function Placeholder(viewName) {
|
|||
this.viewName = viewName;
|
||||
}
|
||||
|
||||
export default EmberObject.extend(Ember.Array, {
|
||||
export default EmberObject.extend(EmberArray, {
|
||||
posts: null,
|
||||
_appendingIds: null,
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberRouter from "@ember/routing/router";
|
||||
import { defaultHomepage } from "discourse/lib/utilities";
|
||||
import { rewritePath } from "discourse/lib/url";
|
||||
import ENV from "discourse-common/config/environment";
|
||||
|
@ -5,7 +6,7 @@ import Site from "discourse/models/site";
|
|||
|
||||
const rootURL = Discourse.BaseUri;
|
||||
|
||||
const BareRouter = Ember.Router.extend({
|
||||
const BareRouter = EmberRouter.extend({
|
||||
rootURL,
|
||||
location: ENV.environment === "test" ? "none" : "discourse-location",
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { warn } from "@ember/debug";
|
||||
import {
|
||||
displayErrorForUpload,
|
||||
validateUploadedFiles
|
||||
|
@ -11,7 +12,7 @@ export default Mixin.create({
|
|||
uploadProgress: 0,
|
||||
|
||||
uploadDone() {
|
||||
Ember.warn("You should implement `uploadDone`", {
|
||||
warn("You should implement `uploadDone`", {
|
||||
id: "discourse.upload.missing-upload-done"
|
||||
});
|
||||
},
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import ArrayProxy from "@ember/array/proxy";
|
||||
import PreloadStore from "preload-store";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import Topic from "discourse/models/topic";
|
||||
import Category from "discourse/models/category";
|
||||
import Site from "discourse/models/site";
|
||||
|
||||
const CategoryList = Ember.ArrayProxy.extend({
|
||||
const CategoryList = ArrayProxy.extend({
|
||||
init() {
|
||||
this.set("content", []);
|
||||
this._super(...arguments);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { warn } from "@ember/debug";
|
||||
import { equal } from "@ember/object/computed";
|
||||
import EmberObject from "@ember/object";
|
||||
import { Promise } from "rsvp";
|
||||
|
@ -24,7 +25,7 @@ const RestModel = EmberObject.extend({
|
|||
const payload = this.__munge(res.payload || res.responseJson);
|
||||
|
||||
if (payload.success === "OK") {
|
||||
Ember.warn("An update call should return the updated attributes", {
|
||||
warn("An update call should return the updated attributes", {
|
||||
id: "discourse.rest-model.update-attributes"
|
||||
});
|
||||
res = props;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import ArrayProxy from "@ember/array/proxy";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { Promise } from "rsvp";
|
||||
|
||||
export default Ember.ArrayProxy.extend({
|
||||
export default ArrayProxy.extend({
|
||||
loading: false,
|
||||
loadingMore: false,
|
||||
totalRows: 0,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { A } from "@ember/array";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { url } from "discourse/lib/computed";
|
||||
|
@ -70,7 +71,7 @@ export default RestModel.extend({
|
|||
this.set("noContentHelp", result.no_results_help);
|
||||
}
|
||||
if (result && result.drafts) {
|
||||
const copy = Ember.A();
|
||||
const copy = A();
|
||||
result.drafts.forEach(draft => {
|
||||
let draftData = JSON.parse(draft.data);
|
||||
draft.post_number = draftData.postId || null;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { A } from "@ember/array";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { url } from "discourse/lib/computed";
|
||||
import RestModel from "discourse/models/rest";
|
||||
|
@ -104,7 +105,7 @@ export default RestModel.extend({
|
|||
this.set("noContentHelp", result.no_results_help);
|
||||
}
|
||||
if (result && result.user_actions) {
|
||||
const copy = Ember.A();
|
||||
const copy = A();
|
||||
result.user_actions.forEach(action => {
|
||||
action.title = emojiUnescape(
|
||||
Handlebars.Utils.escapeExpression(action.title)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { A } from "@ember/array";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { gt, equal, or } from "@ember/object/computed";
|
||||
import EmberObject, { computed } from "@ember/object";
|
||||
|
@ -884,7 +885,7 @@ User.reopenClass(Singleton, {
|
|||
responses.set("count", responses.get("count") + stat.get("count"));
|
||||
});
|
||||
|
||||
const result = Ember.A();
|
||||
const result = A();
|
||||
result.pushObjects(stats.rejectBy("isResponse"));
|
||||
|
||||
let insertAt = 0;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import Application from "@ember/application";
|
||||
import { mapRoutes } from "discourse/mapping-router";
|
||||
|
||||
export default {
|
||||
|
@ -10,8 +11,9 @@ export default {
|
|||
|
||||
// HACK to fix: https://github.com/emberjs/ember.js/issues/10310
|
||||
const originalBuildInstance =
|
||||
originalBuildInstance || Ember.Application.prototype.buildInstance;
|
||||
Ember.Application.prototype.buildInstance = function() {
|
||||
originalBuildInstance || Application.prototype.buildInstance;
|
||||
|
||||
Application.prototype.buildInstance = function() {
|
||||
this.buildRegistry();
|
||||
return originalBuildInstance.apply(this);
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import deprecated from "discourse-common/lib/deprecated";
|
||||
import Evented from "@ember/object/evented";
|
||||
import Service from "@ember/service";
|
||||
|
||||
export default Service.extend(Ember.Evented, {
|
||||
export default Service.extend(Evented, {
|
||||
_events: {},
|
||||
|
||||
on() {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import deprecated from "discourse-common/lib/deprecated";
|
||||
import SelectKitComponent from "select-kit/components/select-kit";
|
||||
import { computed } from "@ember/object";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { isPresent } from "@ember/utils";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
|
||||
export default SelectKitComponent.extend({
|
||||
pluginApiIdentifiers: ["multi-select"],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { computed, default as EmberObject } from "@ember/object";
|
||||
import { computed, guidFor, default as EmberObject } from "@ember/object";
|
||||
import Component from "@ember/component";
|
||||
import deprecated from "discourse-common/lib/deprecated";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
|
@ -76,7 +76,7 @@ export default Component.extend(
|
|||
this.set(
|
||||
"selectKit",
|
||||
EmberObject.create({
|
||||
uniqueID: Ember.guidFor(this),
|
||||
uniqueID: guidFor(this),
|
||||
valueProperty: this.valueProperty,
|
||||
nameProperty: this.nameProperty,
|
||||
options: EmberObject.create(),
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import EmberRouter from "@ember/routing/router";
|
||||
import getUrl from "discourse-common/lib/get-url";
|
||||
import ENV from "discourse-common/config/environment";
|
||||
|
||||
const Router = Ember.Router.extend({
|
||||
const Router = EmberRouter.extend({
|
||||
rootURL: getUrl("/wizard/"),
|
||||
location: ENV.environment === "test" ? "none" : "history"
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Application from "@ember/application";
|
||||
import { buildResolver } from "discourse-common/resolver";
|
||||
|
||||
export default Ember.Application.extend({
|
||||
export default Application.extend({
|
||||
rootElement: "#wizard-main",
|
||||
Resolver: buildResolver("wizard"),
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { notEmpty } from "@ember/object/computed";
|
||||
import { Promise } from "rsvp";
|
||||
/* global Pikaday:true */
|
||||
import { propertyNotEqual } from "discourse/lib/computed";
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
import computed from "discourse-common/utils/decorators";
|
||||
import computed, { observes } from "discourse-common/utils/decorators";
|
||||
import { cookAsync } from "discourse/lib/text";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
timeFormat: "HH:mm:ss",
|
||||
|
@ -24,9 +26,9 @@ export default Component.extend({
|
|||
isValid: true,
|
||||
timezone: null,
|
||||
fromSelected: null,
|
||||
fromFilled: Ember.computed.notEmpty("date"),
|
||||
fromFilled: notEmpty("date"),
|
||||
toSelected: null,
|
||||
toFilled: Ember.computed.notEmpty("toDate"),
|
||||
toFilled: notEmpty("toDate"),
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
@ -113,7 +115,7 @@ export default Component.extend({
|
|||
format = "LL";
|
||||
}
|
||||
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
date: dateTime.format(this.dateFormat),
|
||||
time,
|
||||
dateTime,
|
||||
|
@ -146,7 +148,7 @@ export default Component.extend({
|
|||
format = "LL";
|
||||
}
|
||||
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
date: dateTime.format(this.dateFormat),
|
||||
time,
|
||||
dateTime,
|
||||
|
@ -157,7 +159,7 @@ export default Component.extend({
|
|||
|
||||
@computed("recurring", "timezones", "timezone", "format")
|
||||
options(recurring, timezones, timezone, format) {
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
recurring,
|
||||
timezones,
|
||||
timezone,
|
||||
|
@ -171,7 +173,7 @@ export default Component.extend({
|
|||
"options.{recurring,timezones,timezone,format}"
|
||||
)
|
||||
computedConfig(fromConfig, toConfig, options) {
|
||||
return Ember.Object.create({
|
||||
return EmberObject.create({
|
||||
from: fromConfig,
|
||||
to: toConfig,
|
||||
options
|
||||
|
@ -372,7 +374,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
_setupPicker() {
|
||||
return new Ember.RSVP.Promise(resolve => {
|
||||
return new Promise(resolve => {
|
||||
loadScript("/javascripts/pikaday.js").then(() => {
|
||||
const options = {
|
||||
field: this.$(`.fake-input`)[0],
|
||||
|
|
|
@ -2,6 +2,8 @@ import { once } from "@ember/runloop";
|
|||
import { debounce } from "@ember/runloop";
|
||||
import { cancel } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { equal, gt } from "@ember/object/computed";
|
||||
import { Promise } from "rsvp";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed, { observes, on } from "discourse-common/utils/decorators";
|
||||
|
||||
|
@ -22,6 +24,9 @@ export default Component.extend({
|
|||
presenceUsers: null,
|
||||
channel: null,
|
||||
|
||||
isReply: equal("action", "reply"),
|
||||
shouldDisplay: gt("users.length", 0),
|
||||
|
||||
@on("didInsertElement")
|
||||
composerOpened() {
|
||||
this._lastPublish = new Date();
|
||||
|
@ -113,7 +118,7 @@ export default Component.extend({
|
|||
|
||||
// Don't publish presence if disabled
|
||||
if (this.currentUser.hide_profile_and_presence) {
|
||||
return Ember.RSVP.Promise.resolve();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return ajax("/presence/publish", { type: "POST", data });
|
||||
|
@ -122,8 +127,5 @@ export default Component.extend({
|
|||
@computed("presenceUsers", "currentUser.id")
|
||||
users(users, currentUserId) {
|
||||
return (users || []).filter(user => user.id !== currentUserId);
|
||||
},
|
||||
|
||||
isReply: Ember.computed.equal("action", "reply"),
|
||||
shouldDisplay: Ember.computed.gt("users.length", 0)
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
import { cancel } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { gt } from "@ember/object/computed";
|
||||
import computed, { on } from "discourse-common/utils/decorators";
|
||||
import {
|
||||
keepAliveDuration,
|
||||
|
@ -13,6 +14,8 @@ export default Component.extend({
|
|||
topicId: null,
|
||||
presenceUsers: null,
|
||||
|
||||
shouldDisplay: gt("users.length", 0),
|
||||
|
||||
clear() {
|
||||
if (!this.isDestroyed) this.set("presenceUsers", []);
|
||||
},
|
||||
|
@ -53,7 +56,5 @@ export default Component.extend({
|
|||
user =>
|
||||
user.id !== currentUser.id && !ignoredUsers.includes(user.username)
|
||||
);
|
||||
},
|
||||
|
||||
shouldDisplay: Ember.computed.gt("users.length", 0)
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
import { getRegister } from "discourse-common/lib/get-owner";
|
||||
|
@ -44,7 +45,7 @@ function initializePolls(api) {
|
|||
if (existing) {
|
||||
this._polls[p.name].setProperties(p);
|
||||
} else {
|
||||
this._polls[p.name] = Ember.Object.create(p);
|
||||
this._polls[p.name] = EmberObject.create(p);
|
||||
}
|
||||
});
|
||||
this.set("pollsObject", this._polls);
|
||||
|
@ -78,8 +79,8 @@ function initializePolls(api) {
|
|||
if (quotedId) {
|
||||
const quotedPost = post.quoted[quotedId];
|
||||
if (quotedPost) {
|
||||
post = Ember.Object.create(quotedPost);
|
||||
poll = Ember.Object.create(
|
||||
post = EmberObject.create(quotedPost);
|
||||
poll = EmberObject.create(
|
||||
quotedPost.polls.find(p => p.name === pollName)
|
||||
);
|
||||
vote = quotedPost.polls_votes || {};
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { moduleForWidget, widgetTest } from "helpers/widget-test";
|
||||
|
||||
moduleForWidget("discourse-poll-standard-results");
|
||||
|
||||
const template = `{{mount-widget
|
||||
|
@ -11,7 +13,7 @@ widgetTest("options in descending order", {
|
|||
beforeEach() {
|
||||
this.set(
|
||||
"poll",
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
options: [{ votes: 5 }, { votes: 4 }],
|
||||
voters: 9
|
||||
})
|
||||
|
@ -30,7 +32,7 @@ widgetTest("options in ascending order", {
|
|||
beforeEach() {
|
||||
this.set(
|
||||
"poll",
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
options: [{ votes: 4 }, { votes: 5 }],
|
||||
voters: 9
|
||||
})
|
||||
|
@ -50,7 +52,7 @@ widgetTest("multiple options in descending order", {
|
|||
this.set("isMultiple", true);
|
||||
this.set(
|
||||
"poll",
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
type: "multiple",
|
||||
options: [
|
||||
{ votes: 5, html: "a" },
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import ArrayProxy from "@ember/array/proxy";
|
||||
import Post from "discourse/models/post";
|
||||
import createStore from "helpers/create-store";
|
||||
import User from "discourse/models/user";
|
||||
|
@ -863,7 +864,7 @@ QUnit.test("postsWithPlaceholders", async assert => {
|
|||
const postsWithPlaceholders = postStream.get("postsWithPlaceholders");
|
||||
const store = postStream.store;
|
||||
|
||||
const testProxy = Ember.ArrayProxy.create({ content: postsWithPlaceholders });
|
||||
const testProxy = ArrayProxy.create({ content: postsWithPlaceholders });
|
||||
|
||||
const p1 = store.createRecord("post", { id: 1, post_number: 1 });
|
||||
const p2 = store.createRecord("post", { id: 2, post_number: 2 });
|
||||
|
|
Loading…
Reference in New Issue
Block a user