REFACTOR: Use imports for `Ember.run`
This commit is contained in:
parent
c7475ee03b
commit
5ca60fcb6b
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import debounce from "discourse/lib/debounce";
|
import debounce from "discourse/lib/debounce";
|
||||||
import { renderSpinner } from "discourse/helpers/loading-spinner";
|
import { renderSpinner } from "discourse/helpers/loading-spinner";
|
||||||
|
@ -53,7 +54,7 @@ export default Component.extend(
|
||||||
// force rerender
|
// force rerender
|
||||||
this.rerenderBuffer();
|
this.rerenderBuffer();
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._scrollDown);
|
scheduleOnce("afterRender", this, this._scrollDown);
|
||||||
}, 150),
|
}, 150),
|
||||||
|
|
||||||
buildBuffer(buffer) {
|
buildBuffer(buffer) {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { number } from "discourse/lib/formatter";
|
import { number } from "discourse/lib/formatter";
|
||||||
import loadScript from "discourse/lib/load-script";
|
import loadScript from "discourse/lib/load-script";
|
||||||
|
@ -11,7 +13,7 @@ export default Component.extend({
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
this.resizeHandler = () =>
|
this.resizeHandler = () =>
|
||||||
Ember.run.debounce(this, this._scheduleChartRendering, 500);
|
debounce(this, this._scheduleChartRendering, 500);
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
@ -31,11 +33,11 @@ export default Component.extend({
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
Ember.run.debounce(this, this._scheduleChartRendering, 100);
|
debounce(this, this._scheduleChartRendering, 100);
|
||||||
},
|
},
|
||||||
|
|
||||||
_scheduleChartRendering() {
|
_scheduleChartRendering() {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
this._renderChart(
|
this._renderChart(
|
||||||
this.model,
|
this.model,
|
||||||
this.element && this.element.querySelector(".chart-canvas")
|
this.element && this.element.querySelector(".chart-canvas")
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { number } from "discourse/lib/formatter";
|
import { number } from "discourse/lib/formatter";
|
||||||
import loadScript from "discourse/lib/load-script";
|
import loadScript from "discourse/lib/load-script";
|
||||||
|
@ -9,7 +11,7 @@ export default Component.extend({
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
this.resizeHandler = () =>
|
this.resizeHandler = () =>
|
||||||
Ember.run.debounce(this, this._scheduleChartRendering, 500);
|
debounce(this, this._scheduleChartRendering, 500);
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
@ -29,11 +31,11 @@ export default Component.extend({
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
Ember.run.debounce(this, this._scheduleChartRendering, 100);
|
debounce(this, this._scheduleChartRendering, 100);
|
||||||
},
|
},
|
||||||
|
|
||||||
_scheduleChartRendering() {
|
_scheduleChartRendering() {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
if (!this.element) {
|
if (!this.element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import ReportLoader from "discourse/lib/reports-loader";
|
import ReportLoader from "discourse/lib/reports-loader";
|
||||||
import { exportEntity } from "discourse/lib/export-csv";
|
import { exportEntity } from "discourse/lib/export-csv";
|
||||||
|
@ -313,7 +314,7 @@ export default Component.extend({
|
||||||
|
|
||||||
this.setProperties({ isLoading: true, rateLimitationString: null });
|
this.setProperties({ isLoading: true, rateLimitationString: null });
|
||||||
|
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
let payload = this._buildPayload(["prev_period"]);
|
let payload = this._buildPayload(["prev_period"]);
|
||||||
|
|
||||||
const callback = response => {
|
const callback = response => {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
import { fmt } from "discourse/lib/computed";
|
import { fmt } from "discourse/lib/computed";
|
||||||
|
@ -83,7 +84,7 @@ export default Component.extend({
|
||||||
|
|
||||||
toggleMaximize: function() {
|
toggleMaximize: function() {
|
||||||
this.toggleProperty("maximized");
|
this.toggleProperty("maximized");
|
||||||
Ember.run.next(() => this.appEvents.trigger("ace:resize"));
|
next(() => this.appEvents.trigger("ace:resize"));
|
||||||
},
|
},
|
||||||
|
|
||||||
onlyOverriddenChanged(value) {
|
onlyOverriddenChanged(value) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import UserField from "admin/models/user-field";
|
import UserField from "admin/models/user-field";
|
||||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||||
|
@ -28,7 +29,7 @@ export default Component.extend(bufferedProperty("userField"), {
|
||||||
@observes("editing")
|
@observes("editing")
|
||||||
_focusOnEdit() {
|
_focusOnEdit() {
|
||||||
if (this.editing) {
|
if (this.editing) {
|
||||||
Ember.run.scheduleOnce("afterRender", this, "_focusName");
|
scheduleOnce("afterRender", this, "_focusName");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { default as loadScript, loadCSS } from "discourse/lib/load-script";
|
import { default as loadScript, loadCSS } from "discourse/lib/load-script";
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ export default Component.extend({
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
loadScript("/javascripts/spectrum.js").then(() => {
|
loadScript("/javascripts/spectrum.js").then(() => {
|
||||||
loadCSS("/javascripts/spectrum.css").then(() => {
|
loadCSS("/javascripts/spectrum.css").then(() => {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$(this.element.querySelector(".picker"))
|
$(this.element.querySelector(".picker"))
|
||||||
.spectrum({ color: "#" + this.hexValue })
|
.spectrum({ color: "#" + this.hexValue })
|
||||||
.on("change.spectrum", (me, color) => {
|
.on("change.spectrum", (me, color) => {
|
||||||
|
@ -47,7 +48,7 @@ export default Component.extend({
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
this.hexValueChanged();
|
this.hexValueChanged();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -14,7 +15,7 @@ export default Component.extend(bufferedProperty("host"), {
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
@observes("editing")
|
@observes("editing")
|
||||||
_focusOnInput() {
|
_focusOnInput() {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
this.element.querySelector(".host-name").focus();
|
this.element.querySelector(".host-name").focus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
@ -78,7 +79,7 @@ export default Component.extend({
|
||||||
$(document.body).append($copyRange);
|
$(document.body).append($copyRange);
|
||||||
if (copyText(text, $copyRange[0])) {
|
if (copyText(text, $copyRange[0])) {
|
||||||
this.set("copied", true);
|
this.set("copied", true);
|
||||||
Ember.run.later(() => this.set("copied", false), 2000);
|
later(() => this.set("copied", false), 2000);
|
||||||
}
|
}
|
||||||
$copyRange.remove();
|
$copyRange.remove();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ export default Component.extend({
|
||||||
|
|
||||||
// If we switch to edit mode, jump to the edit textarea
|
// If we switch to edit mode, jump to the edit textarea
|
||||||
if (postAction === "edit") {
|
if (postAction === "edit") {
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
let elem = this.element;
|
let elem = this.element;
|
||||||
let body = elem.closest(".modal-body");
|
let body = elem.closest(".modal-body");
|
||||||
body.scrollTop(body.height());
|
body.scrollTop(body.height());
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
import { fmt } from "discourse/lib/computed";
|
import { fmt } from "discourse/lib/computed";
|
||||||
|
@ -20,7 +21,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
focusPermalink() {
|
focusPermalink() {
|
||||||
Ember.run.schedule("afterRender", () =>
|
schedule("afterRender", () =>
|
||||||
this.element.querySelector(".permalink-url").focus()
|
this.element.querySelector(".permalink-url").focus()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -69,7 +70,7 @@ export default Component.extend({
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$(this.element.querySelector(".external-url")).keydown(e => {
|
$(this.element.querySelector(".external-url")).keydown(e => {
|
||||||
// enter key
|
// enter key
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||||
|
@ -45,18 +47,18 @@ export default Component.extend(
|
||||||
this.resumable.upload();
|
this.resumable.upload();
|
||||||
|
|
||||||
// mark as uploading
|
// mark as uploading
|
||||||
Ember.run.later(() => this.set("isUploading", true));
|
later(() => this.set("isUploading", true));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.resumable.on("fileProgress", file => {
|
this.resumable.on("fileProgress", file => {
|
||||||
// update progress
|
// update progress
|
||||||
Ember.run.later(() =>
|
later(() =>
|
||||||
this.set("progress", parseInt(file.progress() * 100, 10))
|
this.set("progress", parseInt(file.progress() * 100, 10))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.resumable.on("fileSuccess", file => {
|
this.resumable.on("fileSuccess", file => {
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
// mark as not uploading anymore
|
// mark as not uploading anymore
|
||||||
this._reset();
|
this._reset();
|
||||||
|
|
||||||
|
@ -66,7 +68,7 @@ export default Component.extend(
|
||||||
});
|
});
|
||||||
|
|
||||||
this.resumable.on("fileError", (file, message) => {
|
this.resumable.on("fileError", (file, message) => {
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
// mark as not uploading anymore
|
// mark as not uploading anymore
|
||||||
this._reset();
|
this._reset();
|
||||||
|
|
||||||
|
@ -78,7 +80,7 @@ export default Component.extend(
|
||||||
|
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
_assignBrowse() {
|
_assignBrowse() {
|
||||||
Ember.run.schedule("afterRender", () =>
|
schedule("afterRender", () =>
|
||||||
this.resumable.assignBrowse($(this.element))
|
this.resumable.assignBrowse($(this.element))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -117,7 +119,7 @@ export default Component.extend(
|
||||||
click() {
|
click() {
|
||||||
if (this.isUploading) {
|
if (this.isUploading) {
|
||||||
this.resumable.cancel();
|
this.resumable.cancel();
|
||||||
Ember.run.later(() => this._reset());
|
later(() => this._reset());
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
/**
|
/**
|
||||||
A form to create an IP address that will be blocked or whitelisted.
|
A form to create an IP address that will be blocked or whitelisted.
|
||||||
|
@ -62,7 +63,7 @@ export default Component.extend({
|
||||||
.then(result => {
|
.then(result => {
|
||||||
this.setProperties({ ip_address: "", formSubmitted: false });
|
this.setProperties({ ip_address: "", formSubmitted: false });
|
||||||
this.action(ScreenedIpAddress.create(result.screened_ip_address));
|
this.action(ScreenedIpAddress.create(result.screened_ip_address));
|
||||||
Ember.run.schedule("afterRender", () =>
|
schedule("afterRender", () =>
|
||||||
this.element.querySelector(".ip-address-input").focus()
|
this.element.querySelector(".ip-address-input").focus()
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
@ -84,7 +85,7 @@ export default Component.extend({
|
||||||
|
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
_init() {
|
_init() {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$(this.element.querySelector(".ip-address-input")).keydown(e => {
|
$(this.element.querySelector(".ip-address-input")).keydown(e => {
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
this.send("submit");
|
this.send("submit");
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -33,7 +34,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
scheduleAnimation() {
|
scheduleAnimation() {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
this.animate(true);
|
this.animate(true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import WatchedWord from "admin/models/watched-word";
|
import WatchedWord from "admin/models/watched-word";
|
||||||
import {
|
import {
|
||||||
|
@ -64,7 +65,7 @@ export default Component.extend({
|
||||||
message: I18n.t("admin.watched_words.form.success")
|
message: I18n.t("admin.watched_words.form.success")
|
||||||
});
|
});
|
||||||
this.action(WatchedWord.create(result));
|
this.action(WatchedWord.create(result));
|
||||||
Ember.run.schedule("afterRender", () =>
|
schedule("afterRender", () =>
|
||||||
this.element.querySelector(".watched-word-input").focus()
|
this.element.querySelector(".watched-word-input").focus()
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
@ -86,7 +87,7 @@ export default Component.extend({
|
||||||
|
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
_init() {
|
_init() {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$(this.element.querySelector(".watched-word-input")).keydown(e => {
|
$(this.element.querySelector(".watched-word-input")).keydown(e => {
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
this.send("submit");
|
this.send("submit");
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ export default Controller.extend({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
this.set("model.savingStatus", null);
|
this.set("model.savingStatus", null);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
const { get } = Ember;
|
const { get } = Ember;
|
||||||
|
@ -21,7 +22,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
filterReports(filter) {
|
filterReports(filter) {
|
||||||
Ember.run.debounce(this, this._performFiltering, filter, 250);
|
debounce(this, this._performFiltering, filter, 250);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { exportEntity } from "discourse/lib/export-csv";
|
import { exportEntity } from "discourse/lib/export-csv";
|
||||||
import { outputExportResult } from "discourse/lib/export-result";
|
import { outputExportResult } from "discourse/lib/export-result";
|
||||||
|
@ -68,7 +69,7 @@ export default Controller.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
scheduleRefresh() {
|
scheduleRefresh() {
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._refresh);
|
scheduleOnce("afterRender", this, this._refresh);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
let lastSearch;
|
let lastSearch;
|
||||||
|
|
||||||
|
@ -27,14 +28,14 @@ export default Controller.extend({
|
||||||
toggleOverridden() {
|
toggleOverridden() {
|
||||||
this.toggleProperty("overridden");
|
this.toggleProperty("overridden");
|
||||||
this.set("searching", true);
|
this.set("searching", true);
|
||||||
Ember.run.debounce(this, this._performSearch, 400);
|
debounce(this, this._performSearch, 400);
|
||||||
},
|
},
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
const q = this.q;
|
const q = this.q;
|
||||||
if (q !== lastSearch) {
|
if (q !== lastSearch) {
|
||||||
this.set("searching", true);
|
this.set("searching", true);
|
||||||
Ember.run.debounce(this, this._performSearch, 400);
|
debounce(this, this._performSearch, 400);
|
||||||
lastSearch = q;
|
lastSearch = q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import GrantBadgeController from "discourse/mixins/grant-badge-controller";
|
import GrantBadgeController from "discourse/mixins/grant-badge-controller";
|
||||||
|
@ -71,7 +72,7 @@ export default Controller.extend(GrantBadgeController, {
|
||||||
).then(
|
).then(
|
||||||
() => {
|
() => {
|
||||||
this.set("badgeReason", "");
|
this.set("badgeReason", "");
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
// Update the selected badge ID after the combobox has re-rendered.
|
// Update the selected badge ID after the combobox has re-rendered.
|
||||||
const newSelectedBadge = this.grantableBadges[0];
|
const newSelectedBadge = this.grantableBadges[0];
|
||||||
if (newSelectedBadge) {
|
if (newSelectedBadge) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -51,7 +52,7 @@ export default Controller.extend({
|
||||||
if (a) {
|
if (a) {
|
||||||
a.words.unshiftObject(arg);
|
a.words.unshiftObject(arg);
|
||||||
a.incrementProperty("count");
|
a.incrementProperty("count");
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
// remove from other actions lists
|
// remove from other actions lists
|
||||||
let match = null;
|
let match = null;
|
||||||
this.get("adminWatchedWords.model").forEach(action => {
|
this.get("adminWatchedWords.model").forEach(action => {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
// Ember 2.0 removes buffered rendering, but we can still implement it ourselves.
|
// Ember 2.0 removes buffered rendering, but we can still implement it ourselves.
|
||||||
// In the long term we'll want to remove this.
|
// In the long term we'll want to remove this.
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ const Mixin = {
|
||||||
},
|
},
|
||||||
|
|
||||||
rerenderBuffer() {
|
rerenderBuffer() {
|
||||||
Ember.run.scheduleOnce("render", this, this._customRender);
|
scheduleOnce("render", this, this._customRender);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
import { bind } from "@ember/runloop";
|
||||||
import { getOwner } from "discourse-common/lib/get-owner";
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
|
|
||||||
export default Ember.Mixin.create({
|
export default Ember.Mixin.create({
|
||||||
ready() {
|
ready() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
this._onChangeHandler = Ember.run.bind(this, this._onChange);
|
this._onChangeHandler = bind(this, this._onChange);
|
||||||
|
|
||||||
// Default to true
|
// Default to true
|
||||||
Discourse.set("hasFocus", true);
|
Discourse.set("hasFocus", true);
|
||||||
|
|
|
@ -14,6 +14,18 @@ var define, requirejs;
|
||||||
"@ember/object": { default: Ember.Object },
|
"@ember/object": { default: Ember.Object },
|
||||||
"@ember/object/proxy": { default: Ember.ObjectProxy },
|
"@ember/object/proxy": { default: Ember.ObjectProxy },
|
||||||
"@ember/routing/route": { default: Ember.Route },
|
"@ember/routing/route": { default: Ember.Route },
|
||||||
|
"@ember/runloop": {
|
||||||
|
bind: Ember.run.bind,
|
||||||
|
cancel: Ember.run.cancel,
|
||||||
|
debounce: Ember.run.debounce,
|
||||||
|
later: Ember.run.later,
|
||||||
|
next: Ember.run.next,
|
||||||
|
once: Ember.run.once,
|
||||||
|
run: Ember.run,
|
||||||
|
schedule: Ember.run.schedule,
|
||||||
|
scheduleOnce: Ember.run.scheduleOnce,
|
||||||
|
throttle: Ember.run.throttle
|
||||||
|
},
|
||||||
"@ember/service": {
|
"@ember/service": {
|
||||||
default: Ember.Service,
|
default: Ember.Service,
|
||||||
inject: Ember.inject.service
|
inject: Ember.inject.service
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { observes } from "ember-addons/ember-computed-decorators";
|
import { observes } from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -26,7 +27,7 @@ export default Component.extend({
|
||||||
|
|
||||||
@observes("category.fullSlug", "tags")
|
@observes("category.fullSlug", "tags")
|
||||||
refreshClass() {
|
refreshClass() {
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._updateClass);
|
scheduleOnce("afterRender", this, this._updateClass);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeClass() {
|
_removeClass() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import debounce from "discourse/lib/debounce";
|
import debounce from "discourse/lib/debounce";
|
||||||
import { searchForTerm } from "discourse/lib/search";
|
import { searchForTerm } from "discourse/lib/search";
|
||||||
|
@ -57,7 +58,7 @@ export default Component.extend({
|
||||||
chooseMessage(message) {
|
chooseMessage(message) {
|
||||||
const messageId = Ember.get(message, "id");
|
const messageId = Ember.get(message, "id");
|
||||||
this.set("selectedTopicId", messageId);
|
this.set("selectedTopicId", messageId);
|
||||||
Ember.run.next(() =>
|
next(() =>
|
||||||
$(`#choose-message-${messageId}`).prop("checked", "true")
|
$(`#choose-message-${messageId}`).prop("checked", "true")
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import debounce from "discourse/lib/debounce";
|
import debounce from "discourse/lib/debounce";
|
||||||
import { searchForTerm } from "discourse/lib/search";
|
import { searchForTerm } from "discourse/lib/search";
|
||||||
|
@ -62,7 +63,7 @@ export default Component.extend({
|
||||||
actions: {
|
actions: {
|
||||||
chooseTopic(topic) {
|
chooseTopic(topic) {
|
||||||
this.set("selectedTopicId", topic.id);
|
this.set("selectedTopicId", topic.id);
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
document.getElementById(`choose-topic-${topic.id}`).checked = true;
|
document.getElementById(`choose-topic-${topic.id}`).checked = true;
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
import { throttle } from "@ember/runloop";
|
||||||
|
import { run } from "@ember/runloop";
|
||||||
|
import { cancel } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -60,7 +65,7 @@ export default Component.extend(KeyEnterEscape, {
|
||||||
"composer.canEditTopicFeaturedLink"
|
"composer.canEditTopicFeaturedLink"
|
||||||
)
|
)
|
||||||
resize() {
|
resize() {
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -78,8 +83,8 @@ export default Component.extend(KeyEnterEscape, {
|
||||||
|
|
||||||
// One second from now, check to see if the last key was hit when
|
// One second from now, check to see if the last key was hit when
|
||||||
// we recorded it. If it was, the user paused typing.
|
// we recorded it. If it was, the user paused typing.
|
||||||
Ember.run.cancel(this._lastKeyTimeout);
|
cancel(this._lastKeyTimeout);
|
||||||
this._lastKeyTimeout = Ember.run.later(() => {
|
this._lastKeyTimeout = later(() => {
|
||||||
if (lastKeyUp !== this._lastKeyUp) {
|
if (lastKeyUp !== this._lastKeyUp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +121,7 @@ export default Component.extend(KeyEnterEscape, {
|
||||||
|
|
||||||
const throttledPerformDrag = (event => {
|
const throttledPerformDrag = (event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
Ember.run.throttle(this, performDrag, event, THROTTLE_RATE);
|
throttle(this, performDrag, event, THROTTLE_RATE);
|
||||||
}).bind(this);
|
}).bind(this);
|
||||||
|
|
||||||
const endDrag = () => {
|
const endDrag = () => {
|
||||||
|
@ -153,7 +158,7 @@ export default Component.extend(KeyEnterEscape, {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.setupComposerResizeEvents();
|
this.setupComposerResizeEvents();
|
||||||
|
|
||||||
const resize = () => Ember.run(() => this.resize());
|
const resize = () => run(() => this.resize());
|
||||||
const triggerOpen = () => {
|
const triggerOpen = () => {
|
||||||
if (this.get("composer.composeState") === Composer.OPEN) {
|
if (this.get("composer.composeState") === Composer.OPEN) {
|
||||||
this.appEvents.trigger("composer:opened");
|
this.appEvents.trigger("composer:opened");
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
import { throttle } from "@ember/runloop";
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import userSearch from "discourse/lib/user-search";
|
import userSearch from "discourse/lib/user-search";
|
||||||
import {
|
import {
|
||||||
|
@ -183,7 +188,7 @@ export default Component.extend({
|
||||||
transformComplete: v => v.username || v.name,
|
transformComplete: v => v.username || v.name,
|
||||||
afterComplete() {
|
afterComplete() {
|
||||||
// ensures textarea scroll position is correct
|
// ensures textarea scroll position is correct
|
||||||
Ember.run.scheduleOnce("afterRender", () => $input.blur().focus());
|
scheduleOnce("afterRender", () => $input.blur().focus());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -192,7 +197,7 @@ export default Component.extend({
|
||||||
this._initInputPreviewSync($input, $preview);
|
this._initInputPreviewSync($input, $preview);
|
||||||
} else {
|
} else {
|
||||||
$input.on("scroll", () =>
|
$input.on("scroll", () =>
|
||||||
Ember.run.throttle(
|
throttle(
|
||||||
this,
|
this,
|
||||||
this._syncEditorAndPreviewScroll,
|
this._syncEditorAndPreviewScroll,
|
||||||
$input,
|
$input,
|
||||||
|
@ -316,7 +321,7 @@ export default Component.extend({
|
||||||
this.appEvents.on(event, this, this._resetShouldBuildScrollMap);
|
this.appEvents.on(event, this, this._resetShouldBuildScrollMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
$input.on("touchstart mouseenter", () => {
|
$input.on("touchstart mouseenter", () => {
|
||||||
if (!$preview.is(":visible")) return;
|
if (!$preview.is(":visible")) return;
|
||||||
$preview.off("scroll");
|
$preview.off("scroll");
|
||||||
|
@ -342,7 +347,7 @@ export default Component.extend({
|
||||||
this.set("shouldBuildScrollMap", false);
|
this.set("shouldBuildScrollMap", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run.throttle(this, $callback, $input, $preview, this.scrollMap, 20);
|
throttle(this, $callback, $input, $preview, this.scrollMap, 20);
|
||||||
},
|
},
|
||||||
|
|
||||||
_teardownInputPreviewSync() {
|
_teardownInputPreviewSync() {
|
||||||
|
@ -559,7 +564,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_warnMentionedGroups($preview) {
|
_warnMentionedGroups($preview) {
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
var found = this.warnedGroupMentions || [];
|
var found = this.warnedGroupMentions || [];
|
||||||
$preview.find(".mention-group.notify").each((idx, e) => {
|
$preview.find(".mention-group.notify").each((idx, e) => {
|
||||||
const $e = $(e);
|
const $e = $(e);
|
||||||
|
@ -587,7 +592,7 @@ export default Component.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
let found = this.warnedCannotSeeMentions || [];
|
let found = this.warnedCannotSeeMentions || [];
|
||||||
|
|
||||||
$preview.find(".mention.cannot-see").each((idx, e) => {
|
$preview.find(".mention.cannot-see").each((idx, e) => {
|
||||||
|
@ -597,7 +602,7 @@ export default Component.extend({
|
||||||
if (found.indexOf(name) === -1) {
|
if (found.indexOf(name) === -1) {
|
||||||
// add a delay to allow for typing, so you don't open the warning right away
|
// add a delay to allow for typing, so you don't open the warning right away
|
||||||
// previously we would warn after @bob even if you were about to mention @bob2
|
// previously we would warn after @bob even if you were about to mention @bob2
|
||||||
Ember.run.later(
|
later(
|
||||||
this,
|
this,
|
||||||
() => {
|
() => {
|
||||||
if (
|
if (
|
||||||
|
@ -618,7 +623,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_resetUpload(removePlaceholder) {
|
_resetUpload(removePlaceholder) {
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
if (this._validUploads > 0) {
|
if (this._validUploads > 0) {
|
||||||
this._validUploads--;
|
this._validUploads--;
|
||||||
}
|
}
|
||||||
|
@ -897,9 +902,9 @@ export default Component.extend({
|
||||||
@on("willDestroyElement")
|
@on("willDestroyElement")
|
||||||
_composerClosed() {
|
_composerClosed() {
|
||||||
this.appEvents.trigger("composer:will-close");
|
this.appEvents.trigger("composer:will-close");
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
// need to wait a bit for the "slide down" transition of the composer
|
// need to wait a bit for the "slide down" transition of the composer
|
||||||
Ember.run.later(
|
later(
|
||||||
() => this.appEvents.trigger("composer:closed"),
|
() => this.appEvents.trigger("composer:closed"),
|
||||||
Ember.testing ? 0 : 400
|
Ember.testing ? 0 : 400
|
||||||
);
|
);
|
||||||
|
@ -970,7 +975,7 @@ export default Component.extend({
|
||||||
// Paint mentions
|
// Paint mentions
|
||||||
const unseenMentions = linkSeenMentions($preview, this.siteSettings);
|
const unseenMentions = linkSeenMentions($preview, this.siteSettings);
|
||||||
if (unseenMentions.length) {
|
if (unseenMentions.length) {
|
||||||
Ember.run.debounce(
|
debounce(
|
||||||
this,
|
this,
|
||||||
this._renderUnseenMentions,
|
this._renderUnseenMentions,
|
||||||
$preview,
|
$preview,
|
||||||
|
@ -985,7 +990,7 @@ export default Component.extend({
|
||||||
// Paint category hashtags
|
// Paint category hashtags
|
||||||
const unseenCategoryHashtags = linkSeenCategoryHashtags($preview);
|
const unseenCategoryHashtags = linkSeenCategoryHashtags($preview);
|
||||||
if (unseenCategoryHashtags.length) {
|
if (unseenCategoryHashtags.length) {
|
||||||
Ember.run.debounce(
|
debounce(
|
||||||
this,
|
this,
|
||||||
this._renderUnseenCategoryHashtags,
|
this._renderUnseenCategoryHashtags,
|
||||||
$preview,
|
$preview,
|
||||||
|
@ -998,7 +1003,7 @@ export default Component.extend({
|
||||||
if (this.siteSettings.tagging_enabled) {
|
if (this.siteSettings.tagging_enabled) {
|
||||||
const unseenTagHashtags = linkSeenTagHashtags($preview);
|
const unseenTagHashtags = linkSeenTagHashtags($preview);
|
||||||
if (unseenTagHashtags.length) {
|
if (unseenTagHashtags.length) {
|
||||||
Ember.run.debounce(
|
debounce(
|
||||||
this,
|
this,
|
||||||
this._renderUnseenTagHashtags,
|
this._renderUnseenTagHashtags,
|
||||||
$preview,
|
$preview,
|
||||||
|
@ -1009,7 +1014,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paint oneboxes
|
// Paint oneboxes
|
||||||
Ember.run.debounce(
|
debounce(
|
||||||
this,
|
this,
|
||||||
() => {
|
() => {
|
||||||
const oneboxes = {};
|
const oneboxes = {};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import LinkLookup from "discourse/lib/link-lookup";
|
import LinkLookup from "discourse/lib/link-lookup";
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ export default Component.extend({
|
||||||
this.appEvents.on("composer:find-similar", this, this._findSimilar);
|
this.appEvents.on("composer:find-similar", this, this._findSimilar);
|
||||||
this.appEvents.on("composer-messages:close", this, this._closeTop);
|
this.appEvents.on("composer-messages:close", this, this._closeTop);
|
||||||
this.appEvents.on("composer-messages:create", this, this._create);
|
this.appEvents.on("composer-messages:create", this, this._create);
|
||||||
Ember.run.scheduleOnce("afterRender", this, this.reset);
|
scheduleOnce("afterRender", this, this.reset);
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -24,7 +27,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.get("composer.titleLength") > 0) {
|
if (this.get("composer.titleLength") > 0) {
|
||||||
Ember.run.debounce(this, this._titleChanged, 10);
|
debounce(this, this._titleChanged, 10);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -79,13 +82,13 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ember.testing) {
|
if (Ember.testing) {
|
||||||
Ember.run.next(() =>
|
next(() =>
|
||||||
// not ideal but we don't want to run this in current
|
// not ideal but we don't want to run this in current
|
||||||
// runloop to avoid an error in console
|
// runloop to avoid an error in console
|
||||||
this._checkForUrl()
|
this._checkForUrl()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Ember.run.debounce(this, this._checkForUrl, 500);
|
debounce(this, this._checkForUrl, 500);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -134,14 +137,14 @@ export default Component.extend({
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.set("composer.loading", false);
|
this.set("composer.loading", false);
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$(this.element.querySelector("input")).putCursorAtEnd();
|
$(this.element.querySelector("input")).putCursorAtEnd();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._updatePost(loadOnebox);
|
this._updatePost(loadOnebox);
|
||||||
this.set("composer.loading", false);
|
this.set("composer.loading", false);
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$(this.element.querySelector("input")).putCursorAtEnd();
|
$(this.element.querySelector("input")).putCursorAtEnd();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -76,7 +77,7 @@ export default Component.extend({
|
||||||
toggleSelector() {
|
toggleSelector() {
|
||||||
this.set("showSelector", true);
|
this.set("showSelector", true);
|
||||||
|
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$(this.element)
|
$(this.element)
|
||||||
.find("input")
|
.find("input")
|
||||||
.focus();
|
.focus();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { cookAsync } from "discourse/lib/text";
|
import { cookAsync } from "discourse/lib/text";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
@ -12,7 +13,7 @@ const CookText = Component.extend({
|
||||||
this.set("cooked", cooked);
|
this.set("cooked", cooked);
|
||||||
// no choice but to defer this cause
|
// no choice but to defer this cause
|
||||||
// pretty text may only be loaded now
|
// pretty text may only be loaded now
|
||||||
Ember.run.next(() =>
|
next(() =>
|
||||||
window
|
window
|
||||||
.requireModule("pretty-text/upload-short-url")
|
.requireModule("pretty-text/upload-short-url")
|
||||||
.resolveAllShortUrls(ajax)
|
.resolveAllShortUrls(ajax)
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
/*global Mousetrap:true */
|
/*global Mousetrap:true */
|
||||||
|
@ -249,7 +254,7 @@ export default Component.extend({
|
||||||
this._applyEmojiAutocomplete($editorInput);
|
this._applyEmojiAutocomplete($editorInput);
|
||||||
this._applyCategoryHashtagAutocomplete($editorInput);
|
this._applyCategoryHashtagAutocomplete($editorInput);
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._readyNow);
|
scheduleOnce("afterRender", this, this._readyNow);
|
||||||
|
|
||||||
const mouseTrap = Mousetrap(this.element.querySelector(".d-editor-input"));
|
const mouseTrap = Mousetrap(this.element.querySelector(".d-editor-input"));
|
||||||
const shortcuts = this.get("toolbar.shortcuts");
|
const shortcuts = this.get("toolbar.shortcuts");
|
||||||
|
@ -348,7 +353,7 @@ export default Component.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.set("preview", cooked);
|
this.set("preview", cooked);
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
if (this._state !== "inDOM") {
|
if (this._state !== "inDOM") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -372,7 +377,7 @@ export default Component.extend({
|
||||||
if (Ember.testing) {
|
if (Ember.testing) {
|
||||||
this._updatePreview();
|
this._updatePreview();
|
||||||
} else {
|
} else {
|
||||||
Ember.run.debounce(this, this._updatePreview, 30);
|
debounce(this, this._updatePreview, 30);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -432,14 +437,14 @@ export default Component.extend({
|
||||||
emojiPickerIsActive: true
|
emojiPickerIsActive: true
|
||||||
});
|
});
|
||||||
|
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
const filterInput = document.querySelector(
|
const filterInput = document.querySelector(
|
||||||
".emoji-picker input[name='filter']"
|
".emoji-picker input[name='filter']"
|
||||||
);
|
);
|
||||||
if (filterInput) {
|
if (filterInput) {
|
||||||
filterInput.value = v.term;
|
filterInput.value = v.term;
|
||||||
|
|
||||||
Ember.run.later(
|
later(
|
||||||
() => filterInput.dispatchEvent(new Event("input")),
|
() => filterInput.dispatchEvent(new Event("input")),
|
||||||
50
|
50
|
||||||
);
|
);
|
||||||
|
@ -547,7 +552,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_selectText(from, length) {
|
_selectText(from, length) {
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
const textarea = this.element.querySelector("textarea.d-editor-input");
|
const textarea = this.element.querySelector("textarea.d-editor-input");
|
||||||
const $textarea = $(textarea);
|
const $textarea = $(textarea);
|
||||||
const oldScrollPos = $textarea.scrollTop();
|
const oldScrollPos = $textarea.scrollTop();
|
||||||
|
@ -556,7 +561,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
textarea.selectionStart = from;
|
textarea.selectionStart = from;
|
||||||
textarea.selectionEnd = from + length;
|
textarea.selectionEnd = from + length;
|
||||||
Ember.run.next(() => $textarea.trigger("change"));
|
next(() => $textarea.trigger("change"));
|
||||||
$textarea.scrollTop(oldScrollPos);
|
$textarea.scrollTop(oldScrollPos);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -785,7 +790,7 @@ export default Component.extend({
|
||||||
$textarea.val(value);
|
$textarea.val(value);
|
||||||
$textarea.prop("selectionStart", insert.length);
|
$textarea.prop("selectionStart", insert.length);
|
||||||
$textarea.prop("selectionEnd", insert.length);
|
$textarea.prop("selectionEnd", insert.length);
|
||||||
Ember.run.next(() => $textarea.trigger("change"));
|
next(() => $textarea.trigger("change"));
|
||||||
this._focusTextArea();
|
this._focusTextArea();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -886,7 +891,7 @@ export default Component.extend({
|
||||||
// ensures textarea scroll position is correct
|
// ensures textarea scroll position is correct
|
||||||
_focusTextArea() {
|
_focusTextArea() {
|
||||||
const textarea = this.element.querySelector("textarea.d-editor-input");
|
const textarea = this.element.querySelector("textarea.d-editor-input");
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
textarea.blur();
|
textarea.blur();
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNames: ["modal-body"],
|
classNames: ["modal-body"],
|
||||||
|
@ -14,7 +15,7 @@ export default Component.extend({
|
||||||
fixedParent.modal("show");
|
fixedParent.modal("show");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._afterFirstRender);
|
scheduleOnce("afterRender", this, this._afterFirstRender);
|
||||||
this.appEvents.on("modal-body:flash", this, "_flash");
|
this.appEvents.on("modal-body:flash", this, "_flash");
|
||||||
this.appEvents.on("modal-body:clearFlash", this, "_clearFlash");
|
this.appEvents.on("modal-body:clearFlash", this, "_clearFlash");
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import { on } from "ember-addons/ember-computed-decorators";
|
import { on } from "ember-addons/ember-computed-decorators";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
|
||||||
|
@ -32,11 +33,11 @@ export default Component.extend({
|
||||||
setUp() {
|
setUp() {
|
||||||
$("html").on("keydown.discourse-modal", e => {
|
$("html").on("keydown.discourse-modal", e => {
|
||||||
if (e.which === 27 && this.dismissable) {
|
if (e.which === 27 && this.dismissable) {
|
||||||
Ember.run.next(() => $(".modal-header button.modal-close").click());
|
next(() => $(".modal-header button.modal-close").click());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.which === 13 && this.triggerClickOnEnter(e)) {
|
if (e.which === 13 && this.triggerClickOnEnter(e)) {
|
||||||
Ember.run.next(() => $(".modal-footer .btn-primary").click());
|
next(() => $(".modal-footer .btn-primary").click());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
/* global Pikaday:true */
|
/* global Pikaday:true */
|
||||||
import loadScript from "discourse/lib/load-script";
|
import loadScript from "discourse/lib/load-script";
|
||||||
|
@ -37,7 +38,7 @@ export default Component.extend({
|
||||||
|
|
||||||
_loadPikadayPicker(container) {
|
_loadPikadayPicker(container) {
|
||||||
loadScript("/javascripts/pikaday.js").then(() => {
|
loadScript("/javascripts/pikaday.js").then(() => {
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
const default_opts = {
|
const default_opts = {
|
||||||
field: this.element.querySelector(".date-picker"),
|
field: this.element.querySelector(".date-picker"),
|
||||||
container: container || this.element,
|
container: container || this.element,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
/* global Pikaday:true */
|
/* global Pikaday:true */
|
||||||
import loadScript from "discourse/lib/load-script";
|
import loadScript from "discourse/lib/load-script";
|
||||||
|
@ -30,7 +31,7 @@ export default Component.extend({
|
||||||
|
|
||||||
_loadPikadayPicker(container) {
|
_loadPikadayPicker(container) {
|
||||||
loadScript("/javascripts/pikaday.js").then(() => {
|
loadScript("/javascripts/pikaday.js").then(() => {
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
const options = {
|
const options = {
|
||||||
field: this.element.querySelector(".date-picker"),
|
field: this.element.querySelector(".date-picker"),
|
||||||
container: container || null,
|
container: container || null,
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
import { throttle } from "@ember/runloop";
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import AddArchetypeClass from "discourse/mixins/add-archetype-class";
|
import AddArchetypeClass from "discourse/mixins/add-archetype-class";
|
||||||
|
@ -50,13 +54,13 @@ export default Component.extend(
|
||||||
const enteredAt = this.enteredAt;
|
const enteredAt = this.enteredAt;
|
||||||
if (enteredAt && this.lastEnteredAt !== enteredAt) {
|
if (enteredAt && this.lastEnteredAt !== enteredAt) {
|
||||||
this._lastShowTopic = null;
|
this._lastShowTopic = null;
|
||||||
Ember.run.schedule("afterRender", () => this.scrolled());
|
schedule("afterRender", () => this.scrolled());
|
||||||
this.set("lastEnteredAt", enteredAt);
|
this.set("lastEnteredAt", enteredAt);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_highlightPost(postNumber) {
|
_highlightPost(postNumber) {
|
||||||
Ember.run.scheduleOnce("afterRender", null, highlight, postNumber);
|
scheduleOnce("afterRender", null, highlight, postNumber);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideTopicInHeader() {
|
_hideTopicInHeader() {
|
||||||
|
@ -78,7 +82,7 @@ export default Component.extend(
|
||||||
this.pauseHeaderTopicUpdate = true;
|
this.pauseHeaderTopicUpdate = true;
|
||||||
this._lastShowTopic = true;
|
this._lastShowTopic = true;
|
||||||
|
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
this._lastShowTopic = false;
|
this._lastShowTopic = false;
|
||||||
this.pauseHeaderTopicUpdate = false;
|
this.pauseHeaderTopicUpdate = false;
|
||||||
}, debounceDuration);
|
}, debounceDuration);
|
||||||
|
@ -192,7 +196,7 @@ export default Component.extend(
|
||||||
// at the start of the scroll. This feels a lot more snappy compared to waiting
|
// at the start of the scroll. This feels a lot more snappy compared to waiting
|
||||||
// for the scroll to end if we debounce.
|
// for the scroll to end if we debounce.
|
||||||
if (this.site.mobileView && this.hasScrolled) {
|
if (this.site.mobileView && this.hasScrolled) {
|
||||||
Ember.run.throttle(
|
throttle(
|
||||||
this,
|
this,
|
||||||
this.calculateDirection,
|
this.calculateDirection,
|
||||||
offset,
|
offset,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||||
import LoadMore from "discourse/mixins/load-more";
|
import LoadMore from "discourse/mixins/load-more";
|
||||||
|
@ -12,11 +14,11 @@ const DiscoveryTopicsListComponent = Component.extend(UrlRefresh, LoadMore, {
|
||||||
_readjustScrollPosition() {
|
_readjustScrollPosition() {
|
||||||
const scrollTo = this.session.get("topicListScrollPosition");
|
const scrollTo = this.session.get("topicListScrollPosition");
|
||||||
if (scrollTo && scrollTo >= 0) {
|
if (scrollTo && scrollTo >= 0) {
|
||||||
Ember.run.schedule("afterRender", () =>
|
schedule("afterRender", () =>
|
||||||
$(window).scrollTop(scrollTo + 1)
|
$(window).scrollTop(scrollTo + 1)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Ember.run.scheduleOnce("afterRender", this, this.loadMoreUnlessFull);
|
scheduleOnce("afterRender", this, this.loadMoreUnlessFull);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -38,7 +40,7 @@ const DiscoveryTopicsListComponent = Component.extend(UrlRefresh, LoadMore, {
|
||||||
loadMore() {
|
loadMore() {
|
||||||
Discourse.updateContextCount(0);
|
Discourse.updateContextCount(0);
|
||||||
this.model.loadMore().then(hasMoreResults => {
|
this.model.loadMore().then(hasMoreResults => {
|
||||||
Ember.run.schedule("afterRender", () => this.saveScrollPosition());
|
schedule("afterRender", () => this.saveScrollPosition());
|
||||||
if (!hasMoreResults) {
|
if (!hasMoreResults) {
|
||||||
this.eyeline.flushRest();
|
this.eyeline.flushRest();
|
||||||
} else if ($(window).height() >= $(document).height()) {
|
} else if ($(window).height() >= $(document).height()) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { propertyEqual } from "discourse/lib/computed";
|
import { propertyEqual } from "discourse/lib/computed";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -20,7 +21,7 @@ export default Component.extend({
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._addToCollection);
|
scheduleOnce("afterRender", this, this._addToCollection);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addToCollection: function() {
|
_addToCollection: function() {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
|
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
|
||||||
|
|
||||||
export default buildCategoryPanel("topic-template", {
|
export default buildCategoryPanel("topic-template", {
|
||||||
_activeTabChanged: function() {
|
_activeTabChanged: function() {
|
||||||
if (this.activeTab) {
|
if (this.activeTab) {
|
||||||
Ember.run.scheduleOnce("afterRender", () =>
|
scheduleOnce("afterRender", () =>
|
||||||
this.element.querySelector(".d-editor-input").focus()
|
this.element.querySelector(".d-editor-input").focus()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -73,7 +74,7 @@ export default Component.extend({
|
||||||
@observes("selection")
|
@observes("selection")
|
||||||
_updateBasedOnLastPost() {
|
_updateBasedOnLastPost() {
|
||||||
if (!this.autoClose) {
|
if (!this.autoClose) {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
this.set("topicTimer.based_on_last_post", false);
|
this.set("topicTimer.based_on_last_post", false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||||
import autosize from "discourse/lib/autosize";
|
import autosize from "discourse/lib/autosize";
|
||||||
|
|
||||||
export default Ember.TextArea.extend({
|
export default Ember.TextArea.extend({
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
_startWatching() {
|
_startWatching() {
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
$(this.element).focus();
|
$(this.element).focus();
|
||||||
autosize(this.element);
|
autosize(this.element);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { observes } from "ember-addons/ember-computed-decorators";
|
import { observes } from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -16,6 +17,6 @@ export default Component.extend({
|
||||||
|
|
||||||
@observes("nameKey")
|
@observes("nameKey")
|
||||||
selectedChanged() {
|
selectedChanged() {
|
||||||
Ember.run.next(this, this._selectRadio);
|
next(this, this._selectRadio);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { throttle } from "@ember/runloop";
|
||||||
import MountWidget from "discourse/components/mount-widget";
|
import MountWidget from "discourse/components/mount-widget";
|
||||||
import MobileScrollDirection from "discourse/mixins/mobile-scroll-direction";
|
import MobileScrollDirection from "discourse/mixins/mobile-scroll-direction";
|
||||||
import Scrolling from "discourse/mixins/scrolling";
|
import Scrolling from "discourse/mixins/scrolling";
|
||||||
|
@ -78,7 +79,7 @@ const FooterNavComponent = MountWidget.extend(
|
||||||
|
|
||||||
const offset = window.pageYOffset || $("html").scrollTop();
|
const offset = window.pageYOffset || $("html").scrollTop();
|
||||||
|
|
||||||
Ember.run.throttle(
|
throttle(
|
||||||
this,
|
this,
|
||||||
this.calculateDirection,
|
this.calculateDirection,
|
||||||
offset,
|
offset,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { bind } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { on } from "ember-addons/ember-computed-decorators";
|
import { on } from "ember-addons/ember-computed-decorators";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
|
@ -88,10 +89,10 @@ export default Component.extend(
|
||||||
|
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
_setupLogsNotice() {
|
_setupLogsNotice() {
|
||||||
this._boundRerenderBuffer = Ember.run.bind(this, this.rerenderBuffer);
|
this._boundRerenderBuffer = bind(this, this.rerenderBuffer);
|
||||||
LogsNotice.current().addObserver("hidden", this._boundRerenderBuffer);
|
LogsNotice.current().addObserver("hidden", this._boundRerenderBuffer);
|
||||||
|
|
||||||
this._boundResetCurrentProp = Ember.run.bind(
|
this._boundResetCurrentProp = bind(
|
||||||
this,
|
this,
|
||||||
this._resetCurrentProp
|
this._resetCurrentProp
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import { observes } from "ember-addons/ember-computed-decorators";
|
import { observes } from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -25,7 +26,7 @@ export default Component.extend({
|
||||||
|
|
||||||
@observes("model.flair_url")
|
@observes("model.flair_url")
|
||||||
_loadSVGIcon() {
|
_loadSVGIcon() {
|
||||||
Ember.run.debounce(this, this._loadIcon, 1000);
|
debounce(this, this._loadIcon, 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadIcon() {
|
_loadIcon() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import UploadMixin from "discourse/mixins/upload";
|
import UploadMixin from "discourse/mixins/upload";
|
||||||
|
@ -77,13 +78,13 @@ export default Component.extend(UploadMixin, {
|
||||||
},
|
},
|
||||||
|
|
||||||
_openLightbox() {
|
_openLightbox() {
|
||||||
Ember.run.next(() =>
|
next(() =>
|
||||||
$(this.element.querySelector("a.lightbox")).magnificPopup("open")
|
$(this.element.querySelector("a.lightbox")).magnificPopup("open")
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_applyLightbox() {
|
_applyLightbox() {
|
||||||
if (this.imageUrl) Ember.run.next(() => lightbox($(this.element)));
|
if (this.imageUrl) next(() => lightbox($(this.element)));
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
showInput: false,
|
showInput: false,
|
||||||
|
@ -5,7 +6,7 @@ export default Component.extend({
|
||||||
click() {
|
click() {
|
||||||
this.onClick();
|
this.onClick();
|
||||||
|
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$(this.element)
|
$(this.element)
|
||||||
.find("input")
|
.find("input")
|
||||||
.focus();
|
.focus();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
@ -14,7 +15,7 @@ export default Component.extend({
|
||||||
this.set("loginName", $.cookie("email"));
|
this.set("loginName", $.cookie("email"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$(
|
$(
|
||||||
"#login-account-password, #login-account-name, #login-second-factor"
|
"#login-account-password, #login-account-name, #login-second-factor"
|
||||||
).keydown(e => {
|
).keydown(e => {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ export default Component.extend({
|
||||||
@observes("currentPath")
|
@observes("currentPath")
|
||||||
currentPathChanged() {
|
currentPathChanged() {
|
||||||
this.set("expanded", false);
|
this.set("expanded", false);
|
||||||
Ember.run.next(() => this._updateSelectedHtml());
|
next(() => this._updateSelectedHtml());
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSelectedHtml() {
|
_updateSelectedHtml() {
|
||||||
|
@ -41,7 +42,7 @@ export default Component.extend({
|
||||||
toggleExpanded() {
|
toggleExpanded() {
|
||||||
this.toggleProperty("expanded");
|
this.toggleProperty("expanded");
|
||||||
|
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
if (this.expanded) {
|
if (this.expanded) {
|
||||||
$(window)
|
$(window)
|
||||||
.off("click.mobile-nav")
|
.off("click.mobile-nav")
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { cancel } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { diff, patch } from "virtual-dom";
|
import { diff, patch } from "virtual-dom";
|
||||||
import { WidgetClickHook } from "discourse/widgets/hooks";
|
import { WidgetClickHook } from "discourse/widgets/hooks";
|
||||||
|
@ -50,7 +52,7 @@ export default Component.extend({
|
||||||
|
|
||||||
this._rootNode = document.createElement("div");
|
this._rootNode = document.createElement("div");
|
||||||
this.element.appendChild(this._rootNode);
|
this.element.appendChild(this._rootNode);
|
||||||
this._timeout = Ember.run.scheduleOnce("render", this, this.rerenderWidget);
|
this._timeout = scheduleOnce("render", this, this.rerenderWidget);
|
||||||
},
|
},
|
||||||
|
|
||||||
willClearRender() {
|
willClearRender() {
|
||||||
|
@ -68,7 +70,7 @@ export default Component.extend({
|
||||||
const [eventName, caller] = evt;
|
const [eventName, caller] = evt;
|
||||||
this.appEvents.off(eventName, this, caller);
|
this.appEvents.off(eventName, this, caller);
|
||||||
});
|
});
|
||||||
Ember.run.cancel(this._timeout);
|
cancel(this._timeout);
|
||||||
},
|
},
|
||||||
|
|
||||||
afterRender() {},
|
afterRender() {},
|
||||||
|
@ -97,13 +99,13 @@ export default Component.extend({
|
||||||
this._renderCallback = callback;
|
this._renderCallback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run.scheduleOnce("render", this, this.rerenderWidget);
|
scheduleOnce("render", this, this.rerenderWidget);
|
||||||
},
|
},
|
||||||
|
|
||||||
buildArgs() {},
|
buildArgs() {},
|
||||||
|
|
||||||
rerenderWidget() {
|
rerenderWidget() {
|
||||||
Ember.run.cancel(this._timeout);
|
cancel(this._timeout);
|
||||||
|
|
||||||
if (this._rootNode) {
|
if (this._rootNode) {
|
||||||
if (!this._widgetClass) {
|
if (!this._widgetClass) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -69,7 +70,7 @@ export default Component.extend({
|
||||||
if (this.expanded) {
|
if (this.expanded) {
|
||||||
DiscourseURL.appEvents.on("dom:clean", this, this.ensureDropClosed);
|
DiscourseURL.appEvents.on("dom:clean", this, this.ensureDropClosed);
|
||||||
|
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
if (!this.expanded) {
|
if (!this.expanded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +78,7 @@ export default Component.extend({
|
||||||
$(this.element.querySelector(".drop a")).on("click", () => {
|
$(this.element.querySelector(".drop a")).on("click", () => {
|
||||||
this.element.querySelector(".drop").style.display = "none";
|
this.element.querySelector(".drop").style.display = "none";
|
||||||
|
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { bind } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -18,7 +19,7 @@ export default Component.extend({
|
||||||
|
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
_registerListener() {
|
_registerListener() {
|
||||||
this._promptEventHandler = Ember.run.bind(
|
this._promptEventHandler = bind(
|
||||||
this,
|
this,
|
||||||
this._handleInstallPromptEvent
|
this._handleInstallPromptEvent
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import debounce from "discourse/lib/debounce";
|
import debounce from "discourse/lib/debounce";
|
||||||
import { selectedText } from "discourse/lib/utilities";
|
import { selectedText } from "discourse/lib/utilities";
|
||||||
|
@ -103,7 +104,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
// change the position of the button
|
// change the position of the button
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
let top = markerOffset.top;
|
let top = markerOffset.top;
|
||||||
let left = markerOffset.left + Math.max(0, parentScrollLeft);
|
let left = markerOffset.left + Math.max(0, parentScrollLeft);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import Scrolling from "discourse/mixins/scrolling";
|
import Scrolling from "discourse/mixins/scrolling";
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ export default Component.extend(Scrolling, {
|
||||||
|
|
||||||
const data = this.session.get(this.trackerName);
|
const data = this.session.get(this.trackerName);
|
||||||
if (data && data.position >= 0 && data.tag === this.tag) {
|
if (data && data.position >= 0 && data.tag === this.tag) {
|
||||||
Ember.run.next(() => $(window).scrollTop(data.position + 1));
|
next(() => $(window).scrollTop(data.position + 1));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import MountWidget from "discourse/components/mount-widget";
|
import MountWidget from "discourse/components/mount-widget";
|
||||||
import { cloak, uncloak } from "discourse/widgets/post-stream";
|
import { cloak, uncloak } from "discourse/widgets/post-stream";
|
||||||
|
@ -204,7 +207,7 @@ export default MountWidget.extend({
|
||||||
// will cause the browser to scroll to the top of the document
|
// will cause the browser to scroll to the top of the document
|
||||||
// in Chrome. This makes sure the scroll works correctly if that
|
// in Chrome. This makes sure the scroll works correctly if that
|
||||||
// happens.
|
// happens.
|
||||||
Ember.run.next(() => $("html, body").scrollTop(whereY));
|
next(() => $("html, body").scrollTop(whereY));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -270,7 +273,7 @@ export default MountWidget.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_scrollTriggered() {
|
_scrollTriggered() {
|
||||||
Ember.run.scheduleOnce("afterRender", this, this.scrolled);
|
scheduleOnce("afterRender", this, this.scrolled);
|
||||||
},
|
},
|
||||||
|
|
||||||
_posted(staged) {
|
_posted(staged) {
|
||||||
|
@ -306,13 +309,13 @@ export default MountWidget.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_debouncedScroll() {
|
_debouncedScroll() {
|
||||||
Ember.run.debounce(this, this._scrollTriggered, 10);
|
debounce(this, this._scrollTriggered, 10);
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
const debouncedScroll = () =>
|
const debouncedScroll = () =>
|
||||||
Ember.run.debounce(this, this._scrollTriggered, 10);
|
debounce(this, this._scrollTriggered, 10);
|
||||||
|
|
||||||
this._previouslyNearby = {};
|
this._previouslyNearby = {};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { observes } from "ember-addons/ember-computed-decorators";
|
import { observes } from "ember-addons/ember-computed-decorators";
|
||||||
import { escapeExpression } from "discourse/lib/utilities";
|
import { escapeExpression } from "discourse/lib/utilities";
|
||||||
|
@ -72,13 +74,13 @@ export default Component.extend({
|
||||||
|
|
||||||
this._init();
|
this._init();
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", () => this._update());
|
scheduleOnce("afterRender", () => this._update());
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("searchTerm")
|
@observes("searchTerm")
|
||||||
_updateOptions() {
|
_updateOptions() {
|
||||||
this._update();
|
this._update();
|
||||||
Ember.run.debounce(this, this._update, 250);
|
debounce(this, this._update, 250);
|
||||||
},
|
},
|
||||||
|
|
||||||
_init() {
|
_init() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { escapeExpression } from "discourse/lib/utilities";
|
import { escapeExpression } from "discourse/lib/utilities";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -47,7 +48,7 @@ export default Component.extend({
|
||||||
this.element.querySelector(".topic-share-url-for-touch a")
|
this.element.querySelector(".topic-share-url-for-touch a")
|
||||||
);
|
);
|
||||||
|
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
if (!this.capabilities.touch) {
|
if (!this.capabilities.touch) {
|
||||||
$linkForTouch.parent().remove();
|
$linkForTouch.parent().remove();
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { bind } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||||
import { longDateNoYear } from "discourse/lib/formatter";
|
import { longDateNoYear } from "discourse/lib/formatter";
|
||||||
|
@ -89,7 +91,7 @@ export default Component.extend({
|
||||||
this.set("link", url);
|
this.set("link", url);
|
||||||
this.set("visible", true);
|
this.set("visible", true);
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._focusUrl);
|
scheduleOnce("afterRender", this, this._focusUrl);
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseDownHandler(event) {
|
_mouseDownHandler(event) {
|
||||||
|
@ -154,9 +156,9 @@ export default Component.extend({
|
||||||
|
|
||||||
@on("init")
|
@on("init")
|
||||||
_setupHandlers() {
|
_setupHandlers() {
|
||||||
this._boundMouseDownHandler = Ember.run.bind(this, this._mouseDownHandler);
|
this._boundMouseDownHandler = bind(this, this._mouseDownHandler);
|
||||||
this._boundClickHandler = Ember.run.bind(this, this._clickHandler);
|
this._boundClickHandler = bind(this, this._clickHandler);
|
||||||
this._boundKeydownHandler = Ember.run.bind(this, this._keydownHandler);
|
this._boundKeydownHandler = bind(this, this._keydownHandler);
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
action: "showCreateAccount",
|
action: "showCreateAccount",
|
||||||
|
@ -10,7 +11,7 @@ export default Component.extend({
|
||||||
hideForSession() {
|
hideForSession() {
|
||||||
this.session.set("hideSignupCta", true);
|
this.session.set("hideSignupCta", true);
|
||||||
this.keyValueStore.setItem("anon-cta-hidden", new Date().getTime());
|
this.keyValueStore.setItem("anon-cta-hidden", new Date().getTime());
|
||||||
Ember.run.later(
|
later(
|
||||||
() => this.session.set("showSignupCta", false),
|
() => this.session.set("showSignupCta", false),
|
||||||
20 * 1000
|
20 * 1000
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { cancel } from "@ember/runloop";
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import MountWidget from "discourse/components/mount-widget";
|
import MountWidget from "discourse/components/mount-widget";
|
||||||
import { observes } from "ember-addons/ember-computed-decorators";
|
import { observes } from "ember-addons/ember-computed-decorators";
|
||||||
import Docking from "discourse/mixins/docking";
|
import Docking from "discourse/mixins/docking";
|
||||||
|
@ -38,7 +41,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
||||||
_animateClosing($panel, menuOrigin, windowWidth) {
|
_animateClosing($panel, menuOrigin, windowWidth) {
|
||||||
$panel.css(menuOrigin, -windowWidth);
|
$panel.css(menuOrigin, -windowWidth);
|
||||||
this._animate = true;
|
this._animate = true;
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
this.eventDispatched("dom:clean", "header");
|
this.eventDispatched("dom:clean", "header");
|
||||||
this._panMenuOffset = 0;
|
this._panMenuOffset = 0;
|
||||||
});
|
});
|
||||||
|
@ -222,7 +225,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
||||||
this.appEvents.off("header:hide-topic", this, "setTopic");
|
this.appEvents.off("header:hide-topic", this, "setTopic");
|
||||||
this.appEvents.off("dom:clean", this, "_cleanDom");
|
this.appEvents.off("dom:clean", this, "_cleanDom");
|
||||||
|
|
||||||
Ember.run.cancel(this._scheduledRemoveAnimate);
|
cancel(this._scheduledRemoveAnimate);
|
||||||
window.cancelAnimationFrame(this._scheduledMovingAnimation);
|
window.cancelAnimationFrame(this._scheduledMovingAnimation);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -346,7 +349,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
||||||
if (this._animate) {
|
if (this._animate) {
|
||||||
$panel.addClass("animate");
|
$panel.addClass("animate");
|
||||||
$headerCloak.addClass("animate");
|
$headerCloak.addClass("animate");
|
||||||
this._scheduledRemoveAnimate = Ember.run.later(() => {
|
this._scheduledRemoveAnimate = later(() => {
|
||||||
$panel.removeClass("animate");
|
$panel.removeClass("animate");
|
||||||
$headerCloak.removeClass("animate");
|
$headerCloak.removeClass("animate");
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
Ember.run.next(null, () => {
|
next(null, () => {
|
||||||
const $this = $(this.element);
|
const $this = $(this.element);
|
||||||
|
|
||||||
if ($this) {
|
if ($this) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { isNumeric } from "discourse/lib/utilities";
|
import { isNumeric } from "discourse/lib/utilities";
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export default Component.extend({
|
||||||
this._processMinutesChange(value);
|
this._processMinutesChange(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run.schedule("afterRender", () => (event.target.value = value));
|
schedule("afterRender", () => (event.target.value = value));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import CleansUp from "discourse/mixins/cleans-up";
|
import CleansUp from "discourse/mixins/cleans-up";
|
||||||
|
@ -77,7 +78,7 @@ export default Component.extend(CleansUp, {
|
||||||
|
|
||||||
this.setProperties({ topic: data.topic, visible: true });
|
this.setProperties({ topic: data.topic, visible: true });
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._setCSS);
|
scheduleOnce("afterRender", this, this._setCSS);
|
||||||
|
|
||||||
$("html")
|
$("html")
|
||||||
.off("mousedown.topic-entrance")
|
.off("mousedown.topic-entrance")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -69,7 +70,7 @@ export default Component.extend(LoadMore, {
|
||||||
|
|
||||||
let scrollTo = this.session.get("topicListScrollPosition");
|
let scrollTo = this.session.get("topicListScrollPosition");
|
||||||
if (scrollTo && scrollTo >= 0) {
|
if (scrollTo && scrollTo >= 0) {
|
||||||
Ember.run.schedule("afterRender", () =>
|
schedule("afterRender", () =>
|
||||||
$(window).scrollTop(scrollTo + 1)
|
$(window).scrollTop(scrollTo + 1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { observes } from "ember-addons/ember-computed-decorators";
|
import { observes } from "ember-addons/ember-computed-decorators";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
|
@ -52,7 +54,7 @@ export default Component.extend(PanEvents, {
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkSize() {
|
_checkSize() {
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._performCheckSize);
|
scheduleOnce("afterRender", this, this._performCheckSize);
|
||||||
},
|
},
|
||||||
|
|
||||||
// we need to store this so topic progress has something to init with
|
// we need to store this so topic progress has something to init with
|
||||||
|
@ -88,7 +90,7 @@ export default Component.extend(PanEvents, {
|
||||||
composerOpened() {
|
composerOpened() {
|
||||||
this.set("composerOpen", true);
|
this.set("composerOpen", true);
|
||||||
// we need to do the check after animation is done
|
// we need to do the check after animation is done
|
||||||
Ember.run.later(() => this._checkSize(), 500);
|
later(() => this._checkSize(), 500);
|
||||||
},
|
},
|
||||||
|
|
||||||
composerClosed() {
|
composerClosed() {
|
||||||
|
@ -99,7 +101,7 @@ export default Component.extend(PanEvents, {
|
||||||
_collapseFullscreen() {
|
_collapseFullscreen() {
|
||||||
if (this.get("info.topicProgressExpanded")) {
|
if (this.get("info.topicProgressExpanded")) {
|
||||||
$(".timeline-fullscreen").removeClass("show");
|
$(".timeline-fullscreen").removeClass("show");
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +139,7 @@ export default Component.extend(PanEvents, {
|
||||||
} else if (offset <= 0) {
|
} else if (offset <= 0) {
|
||||||
$timelineContainer.css("bottom", "");
|
$timelineContainer.css("bottom", "");
|
||||||
} else {
|
} else {
|
||||||
Ember.run.later(() => this._handlePanDone(offset, event), 20);
|
later(() => this._handlePanDone(offset, event), 20);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -73,7 +74,7 @@ export default Component.extend({
|
||||||
|
|
||||||
@observes("postStream.stream.[]")
|
@observes("postStream.stream.[]")
|
||||||
_updateBar() {
|
_updateBar() {
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._updateProgressBar);
|
scheduleOnce("afterRender", this, this._updateProgressBar);
|
||||||
},
|
},
|
||||||
|
|
||||||
_topicScrolled(event) {
|
_topicScrolled(event) {
|
||||||
|
@ -100,16 +101,16 @@ export default Component.extend({
|
||||||
|
|
||||||
const prevEvent = this.prevEvent;
|
const prevEvent = this.prevEvent;
|
||||||
if (prevEvent) {
|
if (prevEvent) {
|
||||||
Ember.run.scheduleOnce(
|
scheduleOnce(
|
||||||
"afterRender",
|
"afterRender",
|
||||||
this,
|
this,
|
||||||
this._topicScrolled,
|
this._topicScrolled,
|
||||||
prevEvent
|
prevEvent
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._updateProgressBar);
|
scheduleOnce("afterRender", this, this._updateProgressBar);
|
||||||
}
|
}
|
||||||
Ember.run.scheduleOnce("afterRender", this, this._dock);
|
scheduleOnce("afterRender", this, this._dock);
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import MountWidget from "discourse/components/mount-widget";
|
import MountWidget from "discourse/components/mount-widget";
|
||||||
import Docking from "discourse/mixins/docking";
|
import Docking from "discourse/mixins/docking";
|
||||||
import { observes } from "ember-addons/ember-computed-decorators";
|
import { observes } from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -94,7 +95,7 @@ export default MountWidget.extend(Docking, {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
if (this.fullscreen && !this.addShowClass) {
|
if (this.fullscreen && !this.addShowClass) {
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
this.set("addShowClass", true);
|
this.set("addShowClass", true);
|
||||||
this.queueRerender();
|
this.queueRerender();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { cancel } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||||
|
@ -85,7 +87,7 @@ export default Component.extend(
|
||||||
|
|
||||||
// TODO Sam: concerned this can cause a heavy rerender loop
|
// TODO Sam: concerned this can cause a heavy rerender loop
|
||||||
if (!Ember.testing) {
|
if (!Ember.testing) {
|
||||||
this._delayedRerender = Ember.run.later(
|
this._delayedRerender = later(
|
||||||
this,
|
this,
|
||||||
this.rerender,
|
this.rerender,
|
||||||
rerenderDelay
|
rerenderDelay
|
||||||
|
@ -110,7 +112,7 @@ export default Component.extend(
|
||||||
$(this.element).off("click.topic-timer-remove", this.removeTopicTimer);
|
$(this.element).off("click.topic-timer-remove", this.removeTopicTimer);
|
||||||
|
|
||||||
if (this._delayedRerender) {
|
if (this._delayedRerender) {
|
||||||
Ember.run.cancel(this._delayedRerender);
|
cancel(this._delayedRerender);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import LoadMore from "discourse/mixins/load-more";
|
import LoadMore from "discourse/mixins/load-more";
|
||||||
import ClickTrack from "discourse/lib/click-track";
|
import ClickTrack from "discourse/lib/click-track";
|
||||||
|
@ -23,7 +24,7 @@ export default Component.extend(LoadMore, {
|
||||||
classNames: ["user-stream"],
|
classNames: ["user-stream"],
|
||||||
|
|
||||||
_scrollTopOnModelChange: function() {
|
_scrollTopOnModelChange: function() {
|
||||||
Ember.run.schedule("afterRender", () => $(document).scrollTop(0));
|
schedule("afterRender", () => $(document).scrollTop(0));
|
||||||
}.observes("stream.user.id"),
|
}.observes("stream.user.id"),
|
||||||
|
|
||||||
_inserted: Ember.on("didInsertElement", function() {
|
_inserted: Ember.on("didInsertElement", function() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
@ -24,7 +25,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
highlightSecure() {
|
highlightSecure() {
|
||||||
this.send("closeModal");
|
this.send("closeModal");
|
||||||
|
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
const $prefPasswordDiv = $(".pref-password");
|
const $prefPasswordDiv = $(".pref-password");
|
||||||
|
|
||||||
$prefPasswordDiv.addClass("highlighted");
|
$prefPasswordDiv.addClass("highlighted");
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
|
@ -53,7 +54,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
if (this.get("topicController.multiSelect")) {
|
if (this.get("topicController.multiSelect")) {
|
||||||
this.topicController.send("toggleMultiSelect");
|
this.topicController.send("toggleMultiSelect");
|
||||||
}
|
}
|
||||||
Ember.run.next(() =>
|
next(() =>
|
||||||
DiscourseURL.routeTo(this.get("topicController.model.url"))
|
DiscourseURL.routeTo(this.get("topicController.model.url"))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
|
@ -47,7 +48,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.send("closeModal");
|
this.send("closeModal");
|
||||||
this.setProperties({ date: "", time: "", saving: false });
|
this.setProperties({ date: "", time: "", saving: false });
|
||||||
Ember.run.next(() => DiscourseURL.routeTo(topic.url));
|
next(() => DiscourseURL.routeTo(topic.url));
|
||||||
})
|
})
|
||||||
.catch(() =>
|
.catch(() =>
|
||||||
this.flash(I18n.t("topic.change_timestamp.error"), "alert-error")
|
this.flash(I18n.t("topic.change_timestamp.error"), "alert-error")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
|
@ -1046,7 +1047,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
@observes("model.reply", "model.title")
|
@observes("model.reply", "model.title")
|
||||||
_shouldSaveDraft() {
|
_shouldSaveDraft() {
|
||||||
Ember.run.debounce(this, this._saveDraft, 2000);
|
debounce(this, this._saveDraft, 2000);
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("model.categoryId", "lastValidatedAt")
|
@computed("model.categoryId", "lastValidatedAt")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import {
|
import {
|
||||||
on,
|
on,
|
||||||
|
@ -113,7 +114,7 @@ export default Controller.extend({
|
||||||
tryLoading() {
|
tryLoading() {
|
||||||
this.set("loading", true);
|
this.set("loading", true);
|
||||||
|
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
this.lastTransition.retry();
|
this.lastTransition.retry();
|
||||||
this.set("loading", false);
|
this.set("loading", false);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
|
import { cancel } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
import { searchForTerm } from "discourse/lib/search";
|
import { searchForTerm } from "discourse/lib/search";
|
||||||
|
@ -15,7 +18,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
selectedRow: -1
|
selectedRow: -1
|
||||||
});
|
});
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
const element = document.querySelector(".insert-link");
|
const element = document.querySelector(".insert-link");
|
||||||
|
|
||||||
element.addEventListener("keydown", e => this.keyDown(e));
|
element.addEventListener("keydown", e => this.keyDown(e));
|
||||||
|
@ -135,7 +138,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
.closest(".modal-inner-container")
|
.closest(".modal-inner-container")
|
||||||
.removeEventListener("mousedown", this.mouseDown);
|
.removeEventListener("mousedown", this.mouseDown);
|
||||||
|
|
||||||
Ember.run.cancel(this._debounced);
|
cancel(this._debounced);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -174,7 +177,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
search() {
|
search() {
|
||||||
this._debounced = Ember.run.debounce(this, this.triggerSearch, 400);
|
this._debounced = debounce(this, this.triggerSearch, 400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
),
|
),
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
Ember.run.next(() => $("#post-jump").focus());
|
next(() => $("#post-jump").focus());
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
@ -150,7 +152,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
// only need to focus the 2FA input for TOTP
|
// only need to focus the 2FA input for TOTP
|
||||||
if (!this.showSecurityKey) {
|
if (!this.showSecurityKey) {
|
||||||
Ember.run.scheduleOnce("afterRender", () =>
|
scheduleOnce("afterRender", () =>
|
||||||
document
|
document
|
||||||
.getElementById("second-factor")
|
.getElementById("second-factor")
|
||||||
.querySelector("input")
|
.querySelector("input")
|
||||||
|
@ -322,7 +324,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
const loginError = (errorMsg, className, callback) => {
|
const loginError = (errorMsg, className, callback) => {
|
||||||
showModal("login");
|
showModal("login");
|
||||||
|
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
this.flash(errorMsg, className || "success");
|
this.flash(errorMsg, className || "success");
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
|
@ -92,7 +93,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
);
|
);
|
||||||
} else if (!this.canSplitTopic) {
|
} else if (!this.canSplitTopic) {
|
||||||
this.set("selection", "existing_topic");
|
this.set("selection", "existing_topic");
|
||||||
Ember.run.next(() => $("#choose-topic-title").focus());
|
next(() => $("#choose-topic-title").focus());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
import { SECOND_FACTOR_METHODS } from "discourse/models/user";
|
import { SECOND_FACTOR_METHODS } from "discourse/models/user";
|
||||||
|
@ -102,7 +103,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideCopyMessage() {
|
_hideCopyMessage() {
|
||||||
Ember.run.later(
|
later(
|
||||||
() => this.setProperties({ successMessage: null, errorMessage: null }),
|
() => this.setProperties({ successMessage: null, errorMessage: null }),
|
||||||
2000
|
2000
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||||
|
@ -133,7 +135,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run.scheduleOnce("afterRender", () => {
|
scheduleOnce("afterRender", () => {
|
||||||
this.send("showHistory", post, revision);
|
this.send("showHistory", post, revision);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -1426,7 +1428,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
||||||
// automatically unpin topics when the user reaches the bottom
|
// automatically unpin topics when the user reaches the bottom
|
||||||
const max = _.max(postNumbers);
|
const max = _.max(postNumbers);
|
||||||
if (topic.get("pinned") && max >= topic.get("highest_post_number")) {
|
if (topic.get("pinned") && max >= topic.get("highest_post_number")) {
|
||||||
Ember.run.next(() => topic.clearPin());
|
next(() => topic.clearPin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
// Subscribe to "asset-version" change events via the Message Bus
|
// Subscribe to "asset-version" change events via the Message Bus
|
||||||
export default {
|
export default {
|
||||||
name: "asset-version",
|
name: "asset-version",
|
||||||
|
@ -16,7 +17,7 @@ export default {
|
||||||
if (!timeoutIsSet && Discourse.get("requiresRefresh")) {
|
if (!timeoutIsSet && Discourse.get("requiresRefresh")) {
|
||||||
// Since we can do this transparently for people browsing the forum
|
// Since we can do this transparently for people browsing the forum
|
||||||
// hold back the message 24 hours.
|
// hold back the message 24 hours.
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
bootbox.confirm(I18n.t("assets_changed_confirm"), function(result) {
|
bootbox.confirm(I18n.t("assets_changed_confirm"), function(result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
document.location.reload();
|
document.location.reload();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
export default {
|
export default {
|
||||||
name: "auth-complete",
|
name: "auth-complete",
|
||||||
after: "inject-objects",
|
after: "inject-objects",
|
||||||
|
@ -13,7 +14,7 @@ export default {
|
||||||
if (lastAuthResult) {
|
if (lastAuthResult) {
|
||||||
const router = container.lookup("router:main");
|
const router = container.lookup("router:main");
|
||||||
router.one("didTransition", () => {
|
router.one("didTransition", () => {
|
||||||
Ember.run.next(() =>
|
next(() =>
|
||||||
Discourse.authenticationComplete(JSON.parse(lastAuthResult))
|
Discourse.authenticationComplete(JSON.parse(lastAuthResult))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import Mobile from "discourse/lib/mobile";
|
import Mobile from "discourse/lib/mobile";
|
||||||
import { setResolverOption } from "discourse-common/resolver";
|
import { setResolverOption } from "discourse-common/resolver";
|
||||||
import { isAppWebview, postRNWebviewMessage } from "discourse/lib/utilities";
|
import { isAppWebview, postRNWebviewMessage } from "discourse/lib/utilities";
|
||||||
|
@ -17,7 +18,7 @@ export default {
|
||||||
setResolverOption("mobileView", Mobile.mobileView);
|
setResolverOption("mobileView", Mobile.mobileView);
|
||||||
|
|
||||||
if (isAppWebview()) {
|
if (isAppWebview()) {
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
postRNWebviewMessage(
|
postRNWebviewMessage(
|
||||||
"headerBg",
|
"headerBg",
|
||||||
$(".d-header").css("background-color")
|
$(".d-header").css("background-color")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { run } from "@ember/runloop";
|
||||||
import pageVisible from "discourse/lib/page-visible";
|
import pageVisible from "discourse/lib/page-visible";
|
||||||
import logout from "discourse/lib/logout";
|
import logout from "discourse/lib/logout";
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ export function ajax() {
|
||||||
handleRedirect(data);
|
handleRedirect(data);
|
||||||
handleLogoff(xhr);
|
handleLogoff(xhr);
|
||||||
|
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
Discourse.Site.currentProp(
|
Discourse.Site.currentProp(
|
||||||
"isReadOnly",
|
"isReadOnly",
|
||||||
!!xhr.getResponseHeader("Discourse-Readonly")
|
!!xhr.getResponseHeader("Discourse-Readonly")
|
||||||
|
@ -107,7 +108,7 @@ export function ajax() {
|
||||||
data = { result: data, xhr: xhr };
|
data = { result: data, xhr: xhr };
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run(null, resolve, data);
|
run(null, resolve, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
args.error = (xhr, textStatus, errorThrown) => {
|
args.error = (xhr, textStatus, errorThrown) => {
|
||||||
|
@ -128,7 +129,7 @@ export function ajax() {
|
||||||
xhr.jqTextStatus = textStatus;
|
xhr.jqTextStatus = textStatus;
|
||||||
xhr.requestedUrl = url;
|
xhr.requestedUrl = url;
|
||||||
|
|
||||||
Ember.run(null, reject, {
|
run(null, reject, {
|
||||||
jqXHR: xhr,
|
jqXHR: xhr,
|
||||||
textStatus: textStatus,
|
textStatus: textStatus,
|
||||||
errorThrown: errorThrown
|
errorThrown: errorThrown
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { cancel } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
/**
|
/**
|
||||||
This is a jQuery plugin to support autocompleting values in our text fields.
|
This is a jQuery plugin to support autocompleting values in our text fields.
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ export default function(options) {
|
||||||
if (this.length === 0) return;
|
if (this.length === 0) return;
|
||||||
|
|
||||||
if (options === "destroy" || options.updateData) {
|
if (options === "destroy" || options.updateData) {
|
||||||
Ember.run.cancel(inputTimeout);
|
cancel(inputTimeout);
|
||||||
|
|
||||||
$(this)
|
$(this)
|
||||||
.off("keyup.autocomplete")
|
.off("keyup.autocomplete")
|
||||||
|
@ -402,7 +404,7 @@ export default function(options) {
|
||||||
$(this).on("click.autocomplete", () => closeAutocomplete());
|
$(this).on("click.autocomplete", () => closeAutocomplete());
|
||||||
|
|
||||||
$(this).on("paste.autocomplete", () => {
|
$(this).on("paste.autocomplete", () => {
|
||||||
Ember.run.later(() => me.trigger("keydown"), 50);
|
later(() => me.trigger("keydown"), 50);
|
||||||
});
|
});
|
||||||
|
|
||||||
function checkTriggerRule(opts) {
|
function checkTriggerRule(opts) {
|
||||||
|
@ -455,8 +457,8 @@ export default function(options) {
|
||||||
if (options.allowAny) {
|
if (options.allowAny) {
|
||||||
// saves us wiring up a change event as well
|
// saves us wiring up a change event as well
|
||||||
|
|
||||||
Ember.run.cancel(inputTimeout);
|
cancel(inputTimeout);
|
||||||
inputTimeout = Ember.run.later(function() {
|
inputTimeout = later(function() {
|
||||||
if (inputSelectedItems.length === 0) {
|
if (inputSelectedItems.length === 0) {
|
||||||
inputSelectedItems.push("");
|
inputSelectedItems.push("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
function _clean() {
|
function _clean() {
|
||||||
if (window.MiniProfiler) {
|
if (window.MiniProfiler) {
|
||||||
window.MiniProfiler.pageTransition();
|
window.MiniProfiler.pageTransition();
|
||||||
|
@ -35,5 +36,5 @@ function _clean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cleanDOM() {
|
export function cleanDOM() {
|
||||||
Ember.run.scheduleOnce("afterRender", _clean);
|
scheduleOnce("afterRender", _clean);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||||
|
@ -134,7 +135,7 @@ export default {
|
||||||
$link.attr("href", null);
|
$link.attr("href", null);
|
||||||
$link.data("auto-route", true);
|
$link.data("auto-route", true);
|
||||||
|
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
$link.removeClass("no-href");
|
$link.removeClass("no-href");
|
||||||
$link.attr("href", $link.data("href"));
|
$link.attr("href", $link.data("href"));
|
||||||
$link.data("href", null);
|
$link.data("href", null);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { debounce } from "@ember/runloop";
|
||||||
/**
|
/**
|
||||||
Debounce a Javascript function. This means if it's called many times in a time limit it
|
Debounce a Javascript function. This means if it's called many times in a time limit it
|
||||||
should only be executed once (at the end of the limit counted from the last call made).
|
should only be executed once (at the end of the limit counted from the last call made).
|
||||||
|
@ -13,6 +14,6 @@ export default function(func, wait) {
|
||||||
self = this;
|
self = this;
|
||||||
args = arguments;
|
args = arguments;
|
||||||
|
|
||||||
Ember.run.debounce(null, later, wait);
|
debounce(null, later, wait);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import KeyValueStore from "discourse/lib/key-value-store";
|
import KeyValueStore from "discourse/lib/key-value-store";
|
||||||
import { formatUsername } from "discourse/lib/utilities";
|
import { formatUsername } from "discourse/lib/utilities";
|
||||||
|
@ -79,7 +80,7 @@ function confirmNotification() {
|
||||||
const clickEventHandler = () => notification.close();
|
const clickEventHandler = () => notification.close();
|
||||||
|
|
||||||
notification.addEventListener("click", clickEventHandler);
|
notification.addEventListener("click", clickEventHandler);
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
notification.close();
|
notification.close();
|
||||||
notification.removeEventListener("click", clickEventHandler);
|
notification.removeEventListener("click", clickEventHandler);
|
||||||
}, 10 * 1000);
|
}, 10 * 1000);
|
||||||
|
@ -177,7 +178,7 @@ function onNotification(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
notification.addEventListener("click", clickEventHandler);
|
notification.addEventListener("click", clickEventHandler);
|
||||||
Ember.run.later(() => {
|
later(() => {
|
||||||
notification.close();
|
notification.close();
|
||||||
notification.removeEventListener("click", clickEventHandler);
|
notification.removeEventListener("click", clickEventHandler);
|
||||||
}, 10 * 1000);
|
}, 10 * 1000);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { run } from "@ember/runloop";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import Composer from "discourse/models/composer";
|
import Composer from "discourse/models/composer";
|
||||||
import { minimumOffset } from "discourse/lib/offset-calculator";
|
import { minimumOffset } from "discourse/lib/offset-calculator";
|
||||||
|
@ -140,7 +142,7 @@ export default {
|
||||||
quoteReply() {
|
quoteReply() {
|
||||||
this.sendToSelectedPost("replyToPost");
|
this.sendToSelectedPost("replyToPost");
|
||||||
// lazy but should work for now
|
// lazy but should work for now
|
||||||
Ember.run.later(() => $(".d-editor .quote").click(), 500);
|
later(() => $(".d-editor .quote").click(), 500);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
@ -210,7 +212,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
showPageSearch(event) {
|
showPageSearch(event) {
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
this.appEvents.trigger("header:keyboard-trigger", {
|
this.appEvents.trigger("header:keyboard-trigger", {
|
||||||
type: "page-search",
|
type: "page-search",
|
||||||
event
|
event
|
||||||
|
@ -219,7 +221,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
printTopic(event) {
|
printTopic(event) {
|
||||||
Ember.run(() => {
|
run(() => {
|
||||||
if ($(".container.posts").length) {
|
if ($(".container.posts").length) {
|
||||||
event.preventDefault(); // We need to stop printing the current page in Firefox
|
event.preventDefault(); // We need to stop printing the current page in Firefox
|
||||||
this.container.lookup("controller:topic").print();
|
this.container.lookup("controller:topic").print();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { replaceSpan } from "discourse/lib/category-hashtags";
|
import { replaceSpan } from "discourse/lib/category-hashtags";
|
||||||
|
|
||||||
|
@ -7,7 +8,7 @@ const testedKey = "tested";
|
||||||
const testedClass = `hashtag-${testedKey}`;
|
const testedClass = `hashtag-${testedKey}`;
|
||||||
|
|
||||||
function updateFound($hashtags, categorySlugs) {
|
function updateFound($hashtags, categorySlugs) {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$hashtags.each((index, hashtag) => {
|
$hashtags.each((index, hashtag) => {
|
||||||
const categorySlug = categorySlugs[index];
|
const categorySlug = categorySlugs[index];
|
||||||
const link = validCategoryHashtags[categorySlug];
|
const link = validCategoryHashtags[categorySlug];
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { userPath } from "discourse/lib/url";
|
import { userPath } from "discourse/lib/url";
|
||||||
import { formatUsername } from "discourse/lib/utilities";
|
import { formatUsername } from "discourse/lib/utilities";
|
||||||
|
@ -39,7 +40,7 @@ const checked = {};
|
||||||
const cannotSee = [];
|
const cannotSee = [];
|
||||||
|
|
||||||
function updateFound($mentions, usernames) {
|
function updateFound($mentions, usernames) {
|
||||||
Ember.run.scheduleOnce("afterRender", function() {
|
scheduleOnce("afterRender", function() {
|
||||||
$mentions.each((i, e) => {
|
$mentions.each((i, e) => {
|
||||||
const $e = $(e);
|
const $e = $(e);
|
||||||
const username = usernames[i];
|
const username = usernames[i];
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { schedule } from "@ember/runloop";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { replaceSpan } from "discourse/lib/category-hashtags";
|
import { replaceSpan } from "discourse/lib/category-hashtags";
|
||||||
import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
|
import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
|
||||||
|
@ -7,7 +8,7 @@ const checkedTagHashtags = [];
|
||||||
const testedClass = "tag-hashtag-tested";
|
const testedClass = "tag-hashtag-tested";
|
||||||
|
|
||||||
function updateFound($hashtags, tagValues) {
|
function updateFound($hashtags, tagValues) {
|
||||||
Ember.run.schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
$hashtags.each((index, hashtag) => {
|
$hashtags.each((index, hashtag) => {
|
||||||
const tagValue = tagValues[index];
|
const tagValue = tagValues[index];
|
||||||
const link = validTagHashtags[tagValue];
|
const link = validTagHashtags[tagValue];
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { run } from "@ember/runloop";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
const _loaded = {};
|
const _loaded = {};
|
||||||
const _loading = {};
|
const _loading = {};
|
||||||
|
@ -22,7 +23,7 @@ function loadWithTag(path, cb) {
|
||||||
) {
|
) {
|
||||||
s = s.onload = s.onreadystatechange = null;
|
s = s.onload = s.onreadystatechange = null;
|
||||||
if (!abort) {
|
if (!abort) {
|
||||||
Ember.run(null, cb);
|
run(null, cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { next } from "@ember/runloop";
|
||||||
let _started = false;
|
let _started = false;
|
||||||
let cache = {};
|
let cache = {};
|
||||||
let transitionCount = 0;
|
let transitionCount = 0;
|
||||||
|
@ -31,7 +32,7 @@ export function startPageTracking(router, appEvents) {
|
||||||
|
|
||||||
// Refreshing the title is debounced, so we need to trigger this in the
|
// Refreshing the title is debounced, so we need to trigger this in the
|
||||||
// next runloop to have the correct title.
|
// next runloop to have the correct title.
|
||||||
Ember.run.next(() => {
|
next(() => {
|
||||||
let title = Discourse.get("_docTitle");
|
let title = Discourse.get("_docTitle");
|
||||||
|
|
||||||
appEvents.trigger("page:changed", {
|
appEvents.trigger("page:changed", {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
import debounce from "discourse/lib/debounce";
|
import debounce from "discourse/lib/debounce";
|
||||||
import {
|
import {
|
||||||
safariHacksDisabled,
|
safariHacksDisabled,
|
||||||
|
@ -94,7 +95,7 @@ function positioningWorkaround($fixedElement) {
|
||||||
|
|
||||||
if (!iOSWithVisualViewport()) {
|
if (!iOSWithVisualViewport()) {
|
||||||
fixedElement.style.height = oldHeight;
|
fixedElement.style.height = oldHeight;
|
||||||
Ember.run.later(
|
later(
|
||||||
() => $(fixedElement).removeClass("no-transition"),
|
() => $(fixedElement).removeClass("no-transition"),
|
||||||
500
|
500
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { bind } from "@ember/runloop";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
|
||||||
// We use this class to track how long posts in a topic are on the screen.
|
// We use this class to track how long posts in a topic are on the screen.
|
||||||
|
@ -26,7 +27,7 @@ export default class {
|
||||||
// Create an interval timer if we don't have one.
|
// Create an interval timer if we don't have one.
|
||||||
if (!this._interval) {
|
if (!this._interval) {
|
||||||
this._interval = setInterval(() => this.tick(), 1000);
|
this._interval = setInterval(() => this.tick(), 1000);
|
||||||
this._boundScrolled = Ember.run.bind(this, this.scrolled);
|
this._boundScrolled = bind(this, this.scrolled);
|
||||||
$(window).on("scroll.screentrack", this._boundScrolled);
|
$(window).on("scroll.screentrack", this._boundScrolled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue