diff --git a/app/assets/javascripts/discourse/app/templates/components/user-info.hbs b/app/assets/javascripts/discourse/app/templates/components/user-info.hbs index 86f9aab1eff..98f868a492f 100644 --- a/app/assets/javascripts/discourse/app/templates/components/user-info.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/user-info.hbs @@ -27,6 +27,9 @@ {{if this.nameFirst (format-username @user.username) @user.name}} {{/if}} + {{#if (and @showStatus @user.status)}} + + {{/if}}
{{@user.title}}
diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js index a204979770d..604481403b9 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js @@ -50,4 +50,45 @@ module("Integration | Component | user-info", function (hooks) { this.set("includeAvatar", false); assert.notOk(exists(".user-image")); }); + + test("shows status if enabled and user has status", async function (assert) { + this.currentUser.name = "Evil Trout"; + this.currentUser.status = { emoji: "tooth", description: "off to dentist" }; + + await render( + hbs`` + ); + + assert.ok(exists(".user-status-message")); + }); + + test("doesn't show status if enabled but user doesn't have status", async function (assert) { + this.currentUser.name = "Evil Trout"; + + await render( + hbs`` + ); + + assert.notOk(exists(".user-status-message")); + }); + + test("doesn't show status if disabled", async function (assert) { + this.currentUser.name = "Evil Trout"; + this.currentUser.status = { emoji: "tooth", description: "off to dentist" }; + + await render( + hbs`` + ); + + assert.notOk(exists(".user-status-message")); + }); + + test("doesn't show status by default", async function (assert) { + this.currentUser.name = "Evil Trout"; + this.currentUser.status = { emoji: "tooth", description: "off to dentist" }; + + await render(hbs``); + + assert.notOk(exists(".user-status-message")); + }); });