DEV: Remove Ember.Mixin to import @ember/object/mixin (#8269)

This commit is contained in:
Mark VanLandingham 2019-10-30 14:03:08 -05:00 committed by Robin Ward
parent e7eeb7c47f
commit ba4b557114
32 changed files with 68 additions and 32 deletions

View File

@ -1,7 +1,8 @@
import ModalFunctionality from "discourse/mixins/modal-functionality";
import { popupAjaxError } from "discourse/lib/ajax-error";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create(ModalFunctionality, {
export default Mixin.create(ModalFunctionality, {
reason: null,
message: null,
postEdit: null,

View File

@ -1,7 +1,8 @@
import DiscourseURL from "discourse/lib/url";
import computed from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
queryParams: ["period"],
period: "monthly",

View File

@ -1,5 +1,6 @@
import computed from "ember-addons/ember-computed-decorators";
import { categoryLinkHTML } from "discourse/helpers/category-link";
import Mixin from '@ember/object/mixin';
const CUSTOM_TYPES = [
"bool",
@ -19,7 +20,7 @@ const CUSTOM_TYPES = [
const AUTO_REFRESH_ON_SAVE = ["logo", "logo_small", "large_icon"];
export default Ember.Mixin.create({
export default Mixin.create({
classNameBindings: [":row", ":setting", "overridden", "typeClass"],
content: Ember.computed.alias("setting"),
validationMessage: null,

View File

@ -1,6 +1,7 @@
import computed from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
@computed("value", "default")
overridden(val, defaultVal) {
if (val === null) val = "";

View File

@ -12,6 +12,7 @@ var define, requirejs;
inject: Ember.inject.controller
},
"@ember/object": { default: Ember.Object },
"@ember/object/mixin": { default: Ember.Mixin },
"@ember/object/proxy": { default: Ember.ObjectProxy },
"@ember/routing/route": { default: Ember.Route },
"@ember/runloop": {

View File

@ -1,4 +1,5 @@
import EmberObjectProxy from "@ember/object/proxy";
import Mixin from "@ember/object/mixin";
/* global BufferedProxy: true */
export function bufferedProperty(property) {
@ -21,7 +22,7 @@ export function bufferedProperty(property) {
// It's a good idea to null out fields when declaring objects
mixin.property = null;
return Ember.Mixin.create(mixin);
return Mixin.create(mixin);
}
export default bufferedProperty("content");

View File

@ -1,7 +1,8 @@
import { NotificationLevels } from "discourse/lib/notification-levels";
import { on } from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
bulkSelectEnabled: false,
selected: null,

View File

@ -1,6 +1,7 @@
import { propertyEqual, setting } from "discourse/lib/computed";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
isCurrentUser: propertyEqual("model.id", "currentUser.id"),
showEmailOnProfile: setting("moderators_view_emails"),
canStaffCheckEmails: Ember.computed.and(

View File

@ -4,8 +4,9 @@ import { schedule } from "@ember/runloop";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import afterTransition from "discourse/lib/after-transition";
import DiscourseURL from "discourse/lib/url";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
elementId: null, //click detection added for data-{elementId}
triggeringLinkClass: null, //the <a> classname where this card should appear
_showCallback: null, //username, $target - load up data for when show is called, should call this._positionCard($target) when it's done.

View File

@ -1,6 +1,7 @@
import Mixin from '@ember/object/mixin';
// Include this mixin if you want to be notified when the dom should be
// cleaned (usually on route change.)
export default Ember.Mixin.create({
export default Mixin.create({
_initializeChooser: Ember.on("didInsertElement", function() {
this.appEvents.on("dom:clean", this, "cleanUp");
}),

View File

@ -1,4 +1,6 @@
import Mixin from '@ember/object/mixin';
import { debounce } from "@ember/runloop";
const helper = {
offset() {
const mainOffset = $("#main").offset();
@ -7,7 +9,7 @@ const helper = {
}
};
export default Ember.Mixin.create({
export default Mixin.create({
queueDockCheck: null,
init() {

View File

@ -1,8 +1,9 @@
import computed from "ember-addons/ember-computed-decorators";
import UserBadge from "discourse/models/user-badge";
import { convertIconClass } from "discourse-common/lib/icon-library";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
@computed("allBadges.[]", "userBadges.[]")
grantableBadges(allBadges, userBadges) {
const granted = userBadges.reduce((map, badge) => {

View File

@ -1,9 +1,10 @@
import Eyeline from "discourse/lib/eyeline";
import Scrolling from "discourse/mixins/scrolling";
import { on } from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
// Provides the ability to load more items for a view which is scrolled to the bottom.
export default Ember.Mixin.create(Scrolling, {
export default Mixin.create(Scrolling, {
scrolled() {
const eyeline = this.eyeline;
return eyeline && eyeline.update();

View File

@ -1,8 +1,9 @@
import { debounce } from "@ember/runloop";
import Mixin from '@ember/object/mixin';
// Small buffer so that very tiny scrolls don't trigger mobile header switch
const MOBILE_SCROLL_TOLERANCE = 5;
export default Ember.Mixin.create({
export default Mixin.create({
_lastScroll: null,
_bottomHit: 0,

View File

@ -1,6 +1,7 @@
import showModal from "discourse/lib/show-modal";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
flash(text, messageClass) {
this.appEvents.trigger("modal-body:flash", { text, messageClass });
},

View File

@ -1,7 +1,8 @@
import InputValidation from "discourse/models/input-validation";
import { default as computed } from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
@computed()
nameInstructions() {
return I18n.t(

View File

@ -1,7 +1,8 @@
// This mixin allows a route to open the composer
import Composer from "discourse/models/composer";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
openComposer(controller) {
let categoryId = controller.get("category.id");
if (

View File

@ -1,3 +1,4 @@
import Mixin from '@ember/object/mixin';
/**
Pan events is a mixin that allows components to detect and respond to swipe gestures
It fires callbacks for panStart, panEnd, panMove with the pan state, and the original event.
@ -6,7 +7,7 @@ export const SWIPE_VELOCITY = 40;
export const SWIPE_DISTANCE_THRESHOLD = 50;
export const SWIPE_VELOCITY_THRESHOLD = 0.12;
export const MINIMUM_SWIPE_DISTANCE = 5;
export default Ember.Mixin.create({
export default Mixin.create({
//velocity is pixels per ms
_panState: null,

View File

@ -1,7 +1,8 @@
import InputValidation from "discourse/models/input-validation";
import { default as computed } from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
rejectedPasswords: null,
init() {

View File

@ -1,6 +1,7 @@
import { default as computed } from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
saved: false,
@computed("model.isSaving")

View File

@ -1,6 +1,7 @@
import { scheduleOnce } from "@ember/runloop";
import DiscourseURL from "discourse/lib/url";
import { deprecated } from "discourse/mixins/scroll-top";
import Mixin from '@ember/object/mixin';
const context = {
_scrollTop() {
@ -18,7 +19,7 @@ function scrollTop() {
scheduleOnce("afterRender", context, context._scrollTop);
}
export default Ember.Mixin.create({
export default Mixin.create({
didInsertElement() {
deprecated(
"The `ScrollTop` mixin is deprecated. Replace it with a `{{d-section}}` component"

View File

@ -1,5 +1,6 @@
import { scheduleOnce } from "@ember/runloop";
import debounce from "discourse/lib/debounce";
import Mixin from '@ember/object/mixin';
/**
This object provides the DOM methods we need for our Mixin to bind to scrolling
@ -24,7 +25,7 @@ const ScrollingDOMMethods = {
}
};
const Scrolling = Ember.Mixin.create({
const Scrolling = Mixin.create({
// Begin watching for scroll events. By default they will be called at max every 100ms.
// call with {debounce: N} for a diff time
bindScrolling(opts) {

View File

@ -45,7 +45,9 @@
```
**/
const Singleton = Ember.Mixin.create({
import Mixin from '@ember/object/mixin';
const Singleton = Mixin.create({
current() {
if (!this._current) {
this._current = this.createCurrent();

View File

@ -2,9 +2,11 @@ import {
displayErrorForUpload,
validateUploadedFiles
} from "discourse/lib/utilities";
import getUrl from "discourse-common/lib/get-url";
export default Ember.Mixin.create({
import getUrl from "discourse-common/lib/get-url";
import Mixin from '@ember/object/mixin';
export default Mixin.create({
uploading: false,
uploadProgress: 0,

View File

@ -4,8 +4,9 @@ import {
on,
default as computed
} from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
@on("init")
_createUserFields() {
if (!this.site) {

View File

@ -2,8 +2,9 @@ import InputValidation from "discourse/models/input-validation";
import debounce from "discourse/lib/debounce";
import { setting } from "discourse/lib/computed";
import { default as computed } from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
uniqueUsernameValidation: null,
maxUsernameLength: setting("max_username_length"),

View File

@ -1,7 +1,8 @@
import { CLOSE_STATUS_TYPE } from "discourse/controllers/edit-topic-timer";
import { timeframeDetails } from "select-kit/components/future-date-input-selector";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
_computeIconsForValue(value) {
let { icon } = this._updateAt(value);

View File

@ -1,8 +1,9 @@
import { next } from "@ember/runloop";
import { schedule } from "@ember/runloop";
import { on } from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
init() {
this._super(...arguments);

View File

@ -1,10 +1,11 @@
import { throttle } from "@ember/runloop";
import { schedule } from "@ember/runloop";
import { on } from "ember-addons/ember-computed-decorators";
import Mixin from '@ember/object/mixin';
const { bind } = Ember.run;
export default Ember.Mixin.create({
export default Mixin.create({
@on("init")
_initKeys() {
this.keys = {

View File

@ -1,3 +1,5 @@
import Mixin from '@ember/object/mixin';
let _appendContentCallbacks = {};
function appendContent(pluginApiIdentifiers, contentFunction) {
if (Ember.isNone(_appendContentCallbacks[pluginApiIdentifiers])) {
@ -167,7 +169,7 @@ export function clearCallbacks() {
}
const EMPTY_ARRAY = Object.freeze([]);
export default Ember.Mixin.create({
export default Mixin.create({
concatenatedProperties: ["pluginApiIdentifiers"],
pluginApiIdentifiers: EMPTY_ARRAY
});

View File

@ -1,8 +1,9 @@
const { run, get } = Ember;
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import Mixin from '@ember/object/mixin';
export default Ember.Mixin.create({
export default Mixin.create({
willDestroyElement() {
this._super(...arguments);

View File

@ -1,6 +1,7 @@
import Mixin from '@ember/object/mixin';
const { get, isNone, guidFor } = Ember;
export default Ember.Mixin.create({
export default Mixin.create({
valueForContentItem(content) {
switch (typeof content) {
case "string":