From d02e40e989d72e66a18131687735e8059388281e Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 4 Jun 2024 13:37:18 +0100 Subject: [PATCH] DEV: Update action syntax for `routes/discourse.js` (#27283) --- .../discourse/app/routes/discourse.js | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/app/assets/javascripts/discourse/app/routes/discourse.js b/app/assets/javascripts/discourse/app/routes/discourse.js index 3e4e87a60ec..06d72ebb50b 100644 --- a/app/assets/javascripts/discourse/app/routes/discourse.js +++ b/app/assets/javascripts/discourse/app/routes/discourse.js @@ -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() {