mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Update action syntax for routes/discourse.js
(#27283)
This commit is contained in:
parent
aa37be3323
commit
d02e40e989
@ -1,3 +1,4 @@
|
|||||||
|
import { action } from "@ember/object";
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
import { once } from "@ember/runloop";
|
import { once } from "@ember/runloop";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
@ -16,27 +17,25 @@ const DiscourseRoute = Route.extend({
|
|||||||
this.send("_collectTitleTokens", []);
|
this.send("_collectTitleTokens", []);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
_collectTitleTokens(tokens) {
|
_collectTitleTokens(tokens) {
|
||||||
// If there's a title token method, call it and get the token
|
// If there's a title token method, call it and get the token
|
||||||
if (this.titleToken) {
|
if (this.titleToken) {
|
||||||
const t = this.titleToken();
|
const t = this.titleToken();
|
||||||
if (t && t.length) {
|
if (t?.length) {
|
||||||
if (t instanceof Array) {
|
if (t instanceof Array) {
|
||||||
t.forEach(function (ti) {
|
t.forEach((ti) => tokens.push(ti));
|
||||||
tokens.push(ti);
|
} else {
|
||||||
});
|
tokens.push(t);
|
||||||
} else {
|
|
||||||
tokens.push(t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
},
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
refreshTitle() {
|
@action
|
||||||
once(this, this._refreshTitleOnce);
|
refreshTitle() {
|
||||||
},
|
once(this, this._refreshTitleOnce);
|
||||||
},
|
},
|
||||||
|
|
||||||
redirectIfLoginRequired() {
|
redirectIfLoginRequired() {
|
||||||
|
Loading…
Reference in New Issue
Block a user