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:
Jarek Radosz
2020-03-06 23:49:28 +01:00
committed by GitHub
parent 26da99a2d2
commit 48ba65f406
35 changed files with 108 additions and 71 deletions

View File

@ -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)
}
});

View File

@ -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)
}
});