FIX: profile page is not loading (#19351)
When looking as an anonymous user at a profile page of another user (who has user status with an ending date) the profile page wasn't loading. Reported in https://meta.discourse.org/t/profile-page-not-loading/247928.
This commit is contained in:
parent
d3649873a2
commit
f2d0832618
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue