DEV: Ember linting - disallow Ember.* variable usage (#8782)
This commit is contained in:
parent
88779d849f
commit
499b57a9ed
|
@ -1,3 +1,7 @@
|
||||||
{
|
{
|
||||||
"extends": "eslint-config-discourse"
|
"extends": "eslint-config-discourse",
|
||||||
|
"plugins": ["discourse-ember"],
|
||||||
|
"rules": {
|
||||||
|
"discourse-ember/global-ember": 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
import Controller from "@ember/controller";
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Controller.extend({
|
||||||
actions: {
|
actions: {
|
||||||
revokeKey(key) {
|
revokeKey(key) {
|
||||||
key.revoke().catch(popupAjaxError);
|
key.revoke().catch(popupAjaxError);
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
import Controller from "@ember/controller";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Controller.extend({
|
||||||
userModes: [
|
userModes: [
|
||||||
{ id: "all", name: I18n.t("admin.api.all_users") },
|
{ id: "all", name: I18n.t("admin.api.all_users") },
|
||||||
{ id: "single", name: I18n.t("admin.api.single_user") }
|
{ id: "single", name: I18n.t("admin.api.single_user") }
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||||
|
import Controller from "@ember/controller";
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import { empty } from "@ember/object/computed";
|
import { empty } from "@ember/object/computed";
|
||||||
|
|
||||||
export default Ember.Controller.extend(bufferedProperty("model"), {
|
export default Controller.extend(bufferedProperty("model"), {
|
||||||
isNew: empty("model.id"),
|
isNew: empty("model.id"),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -21,7 +23,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
const id = this.get("userField.id");
|
const id = this.get("userField.id");
|
||||||
if (Ember.isEmpty(id)) {
|
if (isEmpty(id)) {
|
||||||
this.destroyAction(this.userField);
|
this.destroyAction(this.userField);
|
||||||
} else {
|
} else {
|
||||||
this.rollbackBuffer();
|
this.rollbackBuffer();
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||||
import { reads } from "@ember/object/computed";
|
import { reads } from "@ember/object/computed";
|
||||||
import { inject } from "@ember/controller";
|
import Controller, { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||||
import { propertyNotEqual } from "discourse/lib/computed";
|
import { propertyNotEqual } from "discourse/lib/computed";
|
||||||
|
import { run } from "@ember/runloop";
|
||||||
|
|
||||||
export default Controller.extend(bufferedProperty("model"), {
|
export default Controller.extend(bufferedProperty("model"), {
|
||||||
adminBadges: inject(),
|
adminBadges: inject(),
|
||||||
|
@ -23,7 +23,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
||||||
// this is needed because the model doesnt have default values
|
// this is needed because the model doesnt have default values
|
||||||
// and as we are using a bufferedProperty it's not accessible
|
// and as we are using a bufferedProperty it's not accessible
|
||||||
// in any other way
|
// in any other way
|
||||||
Ember.run.next(() => {
|
run.next(() => {
|
||||||
if (this.model) {
|
if (this.model) {
|
||||||
if (!this.model.badge_type_id) {
|
if (!this.model.badge_type_id) {
|
||||||
this.model.set(
|
this.model.set(
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import ThemeSettings from "admin/models/theme-settings";
|
import ThemeSettings from "admin/models/theme-settings";
|
||||||
import { THEMES, COMPONENTS } from "admin/models/theme";
|
import { THEMES, COMPONENTS } from "admin/models/theme";
|
||||||
|
import EmberObject from "@ember/object";
|
||||||
|
|
||||||
const THEME_UPLOAD_VAR = 2;
|
const THEME_UPLOAD_VAR = 2;
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
@discourseComputed("model.parentThemes.[]")
|
@discourseComputed("model.parentThemes.[]")
|
||||||
relativesSelectorSettingsForComponent() {
|
relativesSelectorSettingsForComponent() {
|
||||||
return Ember.Object.create({
|
return EmberObject.create({
|
||||||
list_type: "compact",
|
list_type: "compact",
|
||||||
type: "list",
|
type: "list",
|
||||||
preview: null,
|
preview: null,
|
||||||
|
@ -85,7 +86,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
@discourseComputed("model.parentThemes.[]")
|
@discourseComputed("model.parentThemes.[]")
|
||||||
relativesSelectorSettingsForTheme() {
|
relativesSelectorSettingsForTheme() {
|
||||||
return Ember.Object.create({
|
return EmberObject.create({
|
||||||
list_type: "compact",
|
list_type: "compact",
|
||||||
type: "list",
|
type: "list",
|
||||||
preview: null,
|
preview: null,
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Ember.Route.extend({
|
import Route from "@ember/routing/route";
|
||||||
|
|
||||||
|
export default Route.extend({
|
||||||
model(params) {
|
model(params) {
|
||||||
return this.store.find("api-key", params.api_key_id);
|
return this.store.find("api-key", params.api_key_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { bind } from "@ember/runloop";
|
import { bind } from "@ember/runloop";
|
||||||
import { getOwner } from "discourse-common/lib/get-owner";
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
|
import Mixin from "@ember/object/mixin";
|
||||||
|
|
||||||
export default Ember.Mixin.create({
|
export default Mixin.create({
|
||||||
ready() {
|
ready() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,10 @@ var define, requirejs;
|
||||||
},
|
},
|
||||||
"@ember/error": {
|
"@ember/error": {
|
||||||
default: Ember.error
|
default: Ember.error
|
||||||
|
},
|
||||||
|
|
||||||
|
"@ember/object/internals": {
|
||||||
|
guidFor: Ember.guidFor
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { bind, cancel } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import LogsNotice from "discourse/services/logs-notice";
|
import LogsNotice from "discourse/services/logs-notice";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
|
import { computed } from "@ember/object";
|
||||||
|
|
||||||
const _pluginNotices = [];
|
const _pluginNotices = [];
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ export default Component.extend({
|
||||||
this._tearDownObservers();
|
this._tearDownObservers();
|
||||||
},
|
},
|
||||||
|
|
||||||
notices: Ember.computed(
|
notices: computed(
|
||||||
"site.isReadOnly",
|
"site.isReadOnly",
|
||||||
"siteSettings.disable_emails",
|
"siteSettings.disable_emails",
|
||||||
"logNotice.{id,text,hidden}",
|
"logNotice.{id,text,hidden}",
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Ember.Component.extend({
|
import Component from "@ember/component";
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
actions: {
|
actions: {
|
||||||
onChange(tags) {
|
onChange(tags) {
|
||||||
this.valueChanged &&
|
this.valueChanged &&
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Controller from "@ember/controller";
|
import Controller, { inject } from "@ember/controller";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
tagGroups: Ember.inject.controller(),
|
tagGroups: inject(),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onSave() {
|
onSave() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { defaultHomepage } from "discourse/lib/utilities";
|
import { defaultHomepage } from "discourse/lib/utilities";
|
||||||
|
import { guidFor } from "@ember/object/internals";
|
||||||
let popstateFired = false;
|
let popstateFired = false;
|
||||||
const supportsHistoryState = window.history && "state" in window.history;
|
const supportsHistoryState = window.history && "state" in window.history;
|
||||||
const popstateCallbacks = [];
|
const popstateCallbacks = [];
|
||||||
|
@ -174,7 +175,7 @@ const DiscourseLocation = EmberObject.extend({
|
||||||
@param callback {Function}
|
@param callback {Function}
|
||||||
*/
|
*/
|
||||||
onUpdateURL(callback) {
|
onUpdateURL(callback) {
|
||||||
const guid = Ember.guidFor(this);
|
const guid = guidFor(this);
|
||||||
|
|
||||||
$(window).on(`popstate.ember-location-${guid}`, () => {
|
$(window).on(`popstate.ember-location-${guid}`, () => {
|
||||||
const url = this.getURL();
|
const url = this.getURL();
|
||||||
|
@ -215,7 +216,7 @@ const DiscourseLocation = EmberObject.extend({
|
||||||
willDestroy() {
|
willDestroy() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
const guid = Ember.guidFor(this);
|
const guid = guidFor(this);
|
||||||
$(window).off(`popstate.ember-location-${guid}`);
|
$(window).off(`popstate.ember-location-${guid}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
import { run } from "@ember/runloop";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
const { debounce } = Ember.run;
|
const { debounce } = run;
|
||||||
|
|
||||||
let _queue = [];
|
let _queue = [];
|
||||||
let _processing = 0;
|
let _processing = 0;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
import { set } from "@ember/object";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default RestrictedUserRoute.extend({
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
if (!model.user_option.timezone) {
|
if (!model.user_option.timezone) {
|
||||||
Ember.set(model, "user_option.timezone", moment.tz.guess());
|
set(model, "user_option.timezone", moment.tz.guess());
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.set("model", model);
|
controller.set("model", model);
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
import Draft from "discourse/models/draft";
|
import Draft from "discourse/models/draft";
|
||||||
import { computed } from "@ember/object";
|
import { computed } from "@ember/object";
|
||||||
import { camelize } from "@ember/string";
|
import { camelize } from "@ember/string";
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
|
|
||||||
// Component can get destroyed and lose state
|
// Component can get destroyed and lose state
|
||||||
let _topicSnapshot = null;
|
let _topicSnapshot = null;
|
||||||
|
@ -49,7 +50,7 @@ export default DropdownSelectBoxComponent.extend({
|
||||||
_postSnapshot = this.get("composerModel.post");
|
_postSnapshot = this.get("composerModel.post");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ember.isEmpty(this.content)) {
|
if (isEmpty(this.content)) {
|
||||||
this.set("selectKit.isHidden", true);
|
this.set("selectKit.isHidden", true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
import { computed, default as EmberObject } from "@ember/object";
|
import { computed, default as EmberObject } from "@ember/object";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import deprecated from "discourse-common/lib/deprecated";
|
import deprecated from "discourse-common/lib/deprecated";
|
||||||
const { get, isNone, makeArray } = Ember;
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
|
import { get } from "@ember/object";
|
||||||
import UtilsMixin from "select-kit/mixins/utils";
|
import UtilsMixin from "select-kit/mixins/utils";
|
||||||
import PluginApiMixin from "select-kit/mixins/plugin-api";
|
import PluginApiMixin from "select-kit/mixins/plugin-api";
|
||||||
|
import Mixin from "@ember/object/mixin";
|
||||||
|
import { isEmpty, isNone } from "@ember/utils";
|
||||||
import {
|
import {
|
||||||
next,
|
next,
|
||||||
debounce,
|
debounce,
|
||||||
|
@ -26,7 +29,7 @@ export const MAIN_COLLECTION = "MAIN_COLLECTION";
|
||||||
export const ERRORS_COLLECTION = "ERRORS_COLLECTION";
|
export const ERRORS_COLLECTION = "ERRORS_COLLECTION";
|
||||||
|
|
||||||
const EMPTY_OBJECT = Object.freeze({});
|
const EMPTY_OBJECT = Object.freeze({});
|
||||||
const SELECT_KIT_OPTIONS = Ember.Mixin.create({
|
const SELECT_KIT_OPTIONS = Mixin.create({
|
||||||
mergedProperties: ["selectKitOptions"],
|
mergedProperties: ["selectKitOptions"],
|
||||||
selectKitOptions: EMPTY_OBJECT
|
selectKitOptions: EMPTY_OBJECT
|
||||||
});
|
});
|
||||||
|
@ -220,7 +223,7 @@ export default Component.extend(
|
||||||
);
|
);
|
||||||
|
|
||||||
this.selectKit.setProperties({
|
this.selectKit.setProperties({
|
||||||
hasSelection: !Ember.isEmpty(this.value),
|
hasSelection: !isEmpty(this.value),
|
||||||
noneItem: this._modifyNoSelectionWrapper()
|
noneItem: this._modifyNoSelectionWrapper()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -572,7 +575,7 @@ export default Component.extend(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasNoContent = Ember.isEmpty(content);
|
const hasNoContent = isEmpty(content);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.selectKit.hasSelection &&
|
this.selectKit.hasSelection &&
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { computed } from "@ember/object";
|
import { computed } from "@ember/object";
|
||||||
|
import { bind } from "@ember/runloop";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
layoutName: "select-kit/templates/components/select-kit/select-kit-body",
|
layoutName: "select-kit/templates/components/select-kit/select-kit-body",
|
||||||
|
@ -13,10 +14,7 @@ export default Component.extend({
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
this.handleRootMouseDownHandler = Ember.run.bind(
|
this.handleRootMouseDownHandler = bind(this, this.handleRootMouseDown);
|
||||||
this,
|
|
||||||
this.handleRootMouseDown
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
|
|
@ -2,6 +2,7 @@ import Component from "@ember/component";
|
||||||
import { propertyEqual } from "discourse/lib/computed";
|
import { propertyEqual } from "discourse/lib/computed";
|
||||||
import { computed } from "@ember/object";
|
import { computed } from "@ember/object";
|
||||||
import { makeArray } from "discourse-common/lib/helpers";
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
|
import { guidFor } from "@ember/object/internals";
|
||||||
import UtilsMixin from "select-kit/mixins/utils";
|
import UtilsMixin from "select-kit/mixins/utils";
|
||||||
|
|
||||||
export default Component.extend(UtilsMixin, {
|
export default Component.extend(UtilsMixin, {
|
||||||
|
@ -30,7 +31,7 @@ export default Component.extend(UtilsMixin, {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
guid: computed("item", function() {
|
guid: computed("item", function() {
|
||||||
return Ember.guidFor(this.item);
|
return guidFor(this.item);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
ariaLabel: computed("item.ariaLabel", "title", function() {
|
ariaLabel: computed("item.ariaLabel", "title", function() {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { ajax } from "discourse/lib/ajax";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import Mixin from "@ember/object/mixin";
|
import Mixin from "@ember/object/mixin";
|
||||||
import { makeArray } from "discourse-common/lib/helpers";
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
|
|
||||||
export default Mixin.create({
|
export default Mixin.create({
|
||||||
searchTags(url, data, callback) {
|
searchTags(url, data, callback) {
|
||||||
|
@ -55,7 +56,7 @@ export default Mixin.create({
|
||||||
}
|
}
|
||||||
|
|
||||||
const toLowerCaseOrUndefined = string => {
|
const toLowerCaseOrUndefined = string => {
|
||||||
return Ember.isEmpty(string) ? undefined : string.toLowerCase();
|
return isEmpty(string) ? undefined : string.toLowerCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
const inCollection = content
|
const inCollection = content
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Mixin from "@ember/object/mixin";
|
import Mixin from "@ember/object/mixin";
|
||||||
const { get } = Ember;
|
import { get } from "@ember/object";
|
||||||
|
|
||||||
export default Mixin.create({
|
export default Mixin.create({
|
||||||
defaultItem(value, name) {
|
defaultItem(value, name) {
|
||||||
|
@ -57,7 +57,7 @@ export default Mixin.create({
|
||||||
},
|
},
|
||||||
|
|
||||||
findValue(content, item) {
|
findValue(content, item) {
|
||||||
const property = Ember.get(this.selectKit, "valueProperty");
|
const property = get(this.selectKit, "valueProperty");
|
||||||
|
|
||||||
if (!property) {
|
if (!property) {
|
||||||
if (content.indexOf(item) > -1) {
|
if (content.indexOf(item) > -1) {
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
"@arkweid/lefthook": "^0.6.3",
|
"@arkweid/lefthook": "^0.6.3",
|
||||||
"chrome-launcher": "^0.12.0",
|
"chrome-launcher": "^0.12.0",
|
||||||
"chrome-remote-interface": "^0.25",
|
"chrome-remote-interface": "^0.25",
|
||||||
|
"eslint-plugin-discourse-ember": "0.0.3",
|
||||||
"eslint-config-discourse": "1.1.0",
|
"eslint-config-discourse": "1.1.0",
|
||||||
"lodash-cli": "https://github.com/lodash-archive/lodash-cli.git",
|
"lodash-cli": "https://github.com/lodash-archive/lodash-cli.git",
|
||||||
"pretender": "^1.6",
|
"pretender": "^1.6",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import selectKit from "helpers/select-kit-helper";
|
import selectKit from "helpers/select-kit-helper";
|
||||||
import componentTest from "helpers/component-test";
|
import componentTest from "helpers/component-test";
|
||||||
|
import EmberObject from "@ember/object";
|
||||||
|
|
||||||
moduleForComponent("badge-title", { integration: true });
|
moduleForComponent("badge-title", { integration: true });
|
||||||
|
|
||||||
|
@ -10,10 +11,10 @@ componentTest("badge title", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
this.set("subject", selectKit());
|
this.set("subject", selectKit());
|
||||||
this.set("selectableUserBadges", [
|
this.set("selectableUserBadges", [
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
badge: { name: "(none)" }
|
badge: { name: "(none)" }
|
||||||
}),
|
}),
|
||||||
Ember.Object.create({
|
EmberObject.create({
|
||||||
id: 42,
|
id: 42,
|
||||||
badge_id: 102,
|
badge_id: 102,
|
||||||
badge: { name: "Test" }
|
badge: { name: "Test" }
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
NO_CATEGORIES_ID,
|
NO_CATEGORIES_ID,
|
||||||
ALL_CATEGORIES_ID
|
ALL_CATEGORIES_ID
|
||||||
} from "select-kit/components/category-drop";
|
} from "select-kit/components/category-drop";
|
||||||
|
import { set } from "@ember/object";
|
||||||
|
|
||||||
testSelectKitModule("category-drop");
|
testSelectKitModule("category-drop");
|
||||||
|
|
||||||
|
@ -82,8 +83,8 @@ componentTest("[not staff - TL0] displayCategoryDescription", {
|
||||||
template: template(),
|
template: template(),
|
||||||
|
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
Ember.set(this.currentUser, "staff", false);
|
set(this.currentUser, "staff", false);
|
||||||
Ember.set(this.currentUser, "trustLevel", 0);
|
set(this.currentUser, "trustLevel", 0);
|
||||||
|
|
||||||
initCategories(this);
|
initCategories(this);
|
||||||
},
|
},
|
||||||
|
@ -103,8 +104,8 @@ componentTest("[not staff - TL1] displayCategoryDescription", {
|
||||||
template: template(),
|
template: template(),
|
||||||
|
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
Ember.set(this.currentUser, "staff", false);
|
set(this.currentUser, "staff", false);
|
||||||
Ember.set(this.currentUser, "trustLevel", 1);
|
set(this.currentUser, "trustLevel", 1);
|
||||||
|
|
||||||
initCategories(this);
|
initCategories(this);
|
||||||
},
|
},
|
||||||
|
@ -124,8 +125,8 @@ componentTest("[staff - TL0] displayCategoryDescription", {
|
||||||
template: template(),
|
template: template(),
|
||||||
|
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
Ember.set(this.currentUser, "staff", true);
|
set(this.currentUser, "staff", true);
|
||||||
Ember.set(this.currentUser, "trustLevel", 0);
|
set(this.currentUser, "trustLevel", 0);
|
||||||
|
|
||||||
initCategories(this);
|
initCategories(this);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import componentTest from "helpers/component-test";
|
import componentTest from "helpers/component-test";
|
||||||
import { testSelectKitModule } from "./select-kit-test-helper";
|
import { testSelectKitModule } from "./select-kit-test-helper";
|
||||||
import Site from "discourse/models/site";
|
import Site from "discourse/models/site";
|
||||||
|
import { set } from "@ember/object";
|
||||||
|
|
||||||
testSelectKitModule("tag-drop", {
|
testSelectKitModule("tag-drop", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
const site = Site.current();
|
const site = Site.current();
|
||||||
Ember.set(site, "top_tags", ["jeff", "neil", "arpit", "régis"]);
|
set(site, "top_tags", ["jeff", "neil", "arpit", "régis"]);
|
||||||
|
|
||||||
const response = object => {
|
const response = object => {
|
||||||
return [200, { "Content-Type": "application/json" }, object];
|
return [200, { "Content-Type": "application/json" }, object];
|
||||||
|
|
|
@ -4,6 +4,7 @@ import Topic from "discourse/models/topic";
|
||||||
import PostStream from "discourse/models/post-stream";
|
import PostStream from "discourse/models/post-stream";
|
||||||
import { Placeholder } from "discourse/lib/posts-with-placeholders";
|
import { Placeholder } from "discourse/lib/posts-with-placeholders";
|
||||||
import User from "discourse/models/user";
|
import User from "discourse/models/user";
|
||||||
|
import { Promise } from "rsvp";
|
||||||
|
|
||||||
moduleFor("controller:topic", "controller:topic", {
|
moduleFor("controller:topic", "controller:topic", {
|
||||||
needs: [
|
needs: [
|
||||||
|
@ -534,7 +535,7 @@ QUnit.test(
|
||||||
reply_count: 3,
|
reply_count: 3,
|
||||||
destroy: () => {
|
destroy: () => {
|
||||||
destroyed = true;
|
destroyed = true;
|
||||||
return Ember.RSVP.Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { set } from "@ember/object";
|
||||||
export default function(helpers) {
|
export default function(helpers) {
|
||||||
const { response } = helpers;
|
const { response } = helpers;
|
||||||
|
|
||||||
|
@ -136,7 +137,7 @@ export default function(helpers) {
|
||||||
this.put("/review/:id", request => {
|
this.put("/review/:id", request => {
|
||||||
let result = { payload: {} };
|
let result = { payload: {} };
|
||||||
Object.entries(JSON.parse(request.requestBody).reviewable).forEach(t => {
|
Object.entries(JSON.parse(request.requestBody).reviewable).forEach(t => {
|
||||||
Ember.set(result, t[0], t[1]);
|
set(result, t[0], t[1]);
|
||||||
});
|
});
|
||||||
return response(200, result);
|
return response(200, result);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
|
|
||||||
function checkSelectKitIsNotExpanded(selector) {
|
function checkSelectKitIsNotExpanded(selector) {
|
||||||
if (find(selector).hasClass("is-expanded")) {
|
if (find(selector).hasClass("is-expanded")) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
@ -90,7 +92,7 @@ function rowHelper(row) {
|
||||||
},
|
},
|
||||||
value() {
|
value() {
|
||||||
const value = row.attr("data-value");
|
const value = row.attr("data-value");
|
||||||
return Ember.isEmpty(value) ? null : value;
|
return isEmpty(value) ? null : value;
|
||||||
},
|
},
|
||||||
exists() {
|
exists() {
|
||||||
return exists(row);
|
return exists(row);
|
||||||
|
@ -105,7 +107,7 @@ function headerHelper(header) {
|
||||||
return {
|
return {
|
||||||
value() {
|
value() {
|
||||||
const value = header.attr("data-value");
|
const value = header.attr("data-value");
|
||||||
return Ember.isEmpty(value) ? null : value;
|
return isEmpty(value) ? null : value;
|
||||||
},
|
},
|
||||||
name() {
|
name() {
|
||||||
return header.attr("data-name");
|
return header.attr("data-name");
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import PreloadStore from "preload-store";
|
import PreloadStore from "preload-store";
|
||||||
import { asyncTestDiscourse } from "helpers/qunit-helpers";
|
import { asyncTestDiscourse } from "helpers/qunit-helpers";
|
||||||
|
import { Promise } from "rsvp";
|
||||||
|
|
||||||
QUnit.module("preload-store", {
|
QUnit.module("preload-store", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
|
@ -56,7 +57,7 @@ asyncTestDiscourse(
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
const finder = function() {
|
const finder = function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
resolve("hahahah");
|
resolve("hahahah");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -75,7 +76,7 @@ asyncTestDiscourse(
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
const finder = function() {
|
const finder = function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
reject("error");
|
reject("error");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { next } from "@ember/runloop";
|
||||||
import { moduleForWidget, widgetTest } from "helpers/widget-test";
|
import { moduleForWidget, widgetTest } from "helpers/widget-test";
|
||||||
import { createWidget } from "discourse/widgets/widget";
|
import { createWidget } from "discourse/widgets/widget";
|
||||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||||
|
import { Promise } from "rsvp";
|
||||||
import hbs from "discourse/widgets/hbs-compiler";
|
import hbs from "discourse/widgets/hbs-compiler";
|
||||||
|
|
||||||
moduleForWidget("base");
|
moduleForWidget("base");
|
||||||
|
@ -159,7 +160,7 @@ widgetTest("widget update with promise", {
|
||||||
`,
|
`,
|
||||||
|
|
||||||
click() {
|
click() {
|
||||||
return new Ember.RSVP.Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
next(() => {
|
next(() => {
|
||||||
this.state.name = "Robin";
|
this.state.name = "Robin";
|
||||||
resolve();
|
resolve();
|
||||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -741,6 +741,13 @@ eslint-config-discourse@1.1.0:
|
||||||
eslint "^4.19"
|
eslint "^4.19"
|
||||||
prettier "^1.19.1"
|
prettier "^1.19.1"
|
||||||
|
|
||||||
|
eslint-plugin-discourse-ember@0.0.3:
|
||||||
|
version "0.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/eslint-plugin-discourse-ember/-/eslint-plugin-discourse-ember-0.0.3.tgz#69e5876c2ece38ab3d6c4a05f0a20a7dc4c21e37"
|
||||||
|
integrity sha512-EFwWU4FlOSLBa4RolKZL8QD1eGOnvSkACLt4Big+o1ZUIpW7gGvfnJPtxkbaQ4XmhtZ5HetYt6862vVqhUMv9A==
|
||||||
|
dependencies:
|
||||||
|
requireindex "~1.1.0"
|
||||||
|
|
||||||
eslint-plugin-lodash@^6.0.0:
|
eslint-plugin-lodash@^6.0.0:
|
||||||
version "6.0.0"
|
version "6.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-plugin-lodash/-/eslint-plugin-lodash-6.0.0.tgz#70fa487ab632e62627ecf01ad3e85c228e3ab9d3"
|
resolved "https://registry.yarnpkg.com/eslint-plugin-lodash/-/eslint-plugin-lodash-6.0.0.tgz#70fa487ab632e62627ecf01ad3e85c228e3ab9d3"
|
||||||
|
@ -2075,6 +2082,11 @@ require-uncached@^1.0.3:
|
||||||
caller-path "^0.1.0"
|
caller-path "^0.1.0"
|
||||||
resolve-from "^1.0.0"
|
resolve-from "^1.0.0"
|
||||||
|
|
||||||
|
requireindex@~1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.1.0.tgz#e5404b81557ef75db6e49c5a72004893fe03e162"
|
||||||
|
integrity sha1-5UBLgVV+91225JxacgBIk/4D4WI=
|
||||||
|
|
||||||
resolve-dir@^1.0.0, resolve-dir@^1.0.1:
|
resolve-dir@^1.0.0, resolve-dir@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43"
|
resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43"
|
||||||
|
|
Loading…
Reference in New Issue