From a3883d2a9a697619e6e0db9b2538e3f6a252da98 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 15 Jan 2024 11:52:19 +0000 Subject: [PATCH] DEV: Resolve registerUnbound deprecation (#188) --- assets/javascripts/discourse/helpers/format-unix-date.js | 5 ++--- assets/javascripts/discourse/helpers/user-viewing-self.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/assets/javascripts/discourse/helpers/format-unix-date.js b/assets/javascripts/discourse/helpers/format-unix-date.js index 8ff6645..6e06df8 100644 --- a/assets/javascripts/discourse/helpers/format-unix-date.js +++ b/assets/javascripts/discourse/helpers/format-unix-date.js @@ -1,8 +1,7 @@ -import { registerUnbound } from "discourse-common/lib/helpers"; import { autoUpdatingRelativeAge } from "discourse/lib/formatter"; import { htmlSafe } from "@ember/template"; -registerUnbound("format-unix-date", function (timestamp) { +export default function formatUnixDate(timestamp) { if (timestamp) { const date = new Date(moment.unix(timestamp).format()); @@ -14,4 +13,4 @@ registerUnbound("format-unix-date", function (timestamp) { }) ); } -}); +} diff --git a/assets/javascripts/discourse/helpers/user-viewing-self.js b/assets/javascripts/discourse/helpers/user-viewing-self.js index c0fa01d..eda4f44 100644 --- a/assets/javascripts/discourse/helpers/user-viewing-self.js +++ b/assets/javascripts/discourse/helpers/user-viewing-self.js @@ -1,7 +1,6 @@ -import { registerUnbound } from "discourse-common/lib/helpers"; import User from "discourse/models/user"; -export default registerUnbound("user-viewing-self", function (model) { +export default function userViewingSelf(model) { if (User.current()) { return ( User.current().username.toLowerCase() === model.username.toLowerCase() @@ -9,4 +8,4 @@ export default registerUnbound("user-viewing-self", function (model) { } return false; -}); +}