DEV: Update action syntax for `routes/discourse.js` (#27283)

This commit is contained in:
David Taylor 2024-06-04 13:37:18 +01:00 committed by GitHub
parent aa37be3323
commit d02e40e989
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 18 deletions

View File

@ -1,3 +1,4 @@
import { action } from "@ember/object";
import Route from "@ember/routing/route";
import { once } from "@ember/runloop";
import { service } from "@ember/service";
@ -16,27 +17,25 @@ const DiscourseRoute = Route.extend({
this.send("_collectTitleTokens", []);
},
actions: {
_collectTitleTokens(tokens) {
// If there's a title token method, call it and get the token
if (this.titleToken) {
const t = this.titleToken();
if (t && t.length) {
if (t instanceof Array) {
t.forEach(function (ti) {
tokens.push(ti);
});
} else {
tokens.push(t);
}
@action
_collectTitleTokens(tokens) {
// If there's a title token method, call it and get the token
if (this.titleToken) {
const t = this.titleToken();
if (t?.length) {
if (t instanceof Array) {
t.forEach((ti) => tokens.push(ti));
} else {
tokens.push(t);
}
}
return true;
},
}
return true;
},
refreshTitle() {
once(this, this._refreshTitleOnce);
},
@action
refreshTitle() {
once(this, this._refreshTitleOnce);
},
redirectIfLoginRequired() {