A platform for community discussion. Free, open, simple.
FIX: profile page is not loading (#19351)
Andrei Prigorshnevf2d0832618da
diff --git a/app/assets/javascripts/discourse/app/components/user-status-message.js b/app/assets/javascripts/discourse/app/components/user-status-message.jsindex 857cc030399..e7b74052774 100644--- a/app/assets/javascripts/discourse/app/components/user-status-message.js+++ b/app/assets/javascripts/discourse/app/components/user-status-message.js@@ -12,10 +12,10 @@ export default class UserStatusMessage extends Component {return null;}- return until(- this.status.ends_at,- this.currentUser.user_option.timezone,- this.currentUser.locale- );+ const timezone = this.currentUser+ ? this.currentUser.timezone+ : moment.tz.guess();++ return until(this.status.ends_at, timezone, this.currentUser?.locale);}}diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-status-message-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-status-message-test.jsindex 82364918ab1..15e174b83aa 100644--- a/app/assets/javascripts/discourse/tests/integration/components/user-status-message-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/user-status-message-test.js@@ -141,4 +141,17 @@ module("Integration | Component | user-status-message", function (hooks) {document.querySelector("[data-tippy-root] .user-status-message-tooltip"));});++ test("doesn't blow up with an anonymous user", async function (assert) {+ this.owner.unregister("service:current-user");+ this.set("status", {+ emoji: "tooth",+ description: "off to dentist",+ ends_at: "2100-02-02T12:30:00.000Z",+ });++ await render(hbs`<UserStatusMessage @status={{this.status}} />`);++ assert.dom(".user-status-message").exists();+ });});