DEV: Resolve registerUnbound deprecation (#188)

This commit is contained in:
David Taylor 2024-01-15 11:52:19 +00:00 committed by GitHub
parent 331c8630c3
commit a3883d2a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -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) {
})
);
}
});
}

View File

@ -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;
});
}