From 3ee8678cf1725d6469cc82f8602054e9a10aeb74 Mon Sep 17 00:00:00 2001 From: Kris Date: Wed, 4 Oct 2023 19:44:54 -0400 Subject: [PATCH] FIX: don't nest all user info in one link (#23783) --- .../app/components/about-page-users.hbs | 38 ++++---- .../discourse/app/components/user-info.hbs | 87 ++++++++++--------- .../integration/components/user-info-test.js | 6 +- .../common/components/user-info.scss | 19 ++-- 4 files changed, 78 insertions(+), 72 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/about-page-users.hbs b/app/assets/javascripts/discourse/app/components/about-page-users.hbs index c3883485fc6..a8d0e3ecabc 100644 --- a/app/assets/javascripts/discourse/app/components/about-page-users.hbs +++ b/app/assets/javascripts/discourse/app/components/about-page-users.hbs @@ -1,20 +1,26 @@ {{#each this.usersTemplates as |userTemplate|}}
- -
- {{/each}} \ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/user-info.hbs b/app/assets/javascripts/discourse/app/components/user-info.hbs index 0432aa97e05..7f2feeb0a77 100644 --- a/app/assets/javascripts/discourse/app/components/user-info.hbs +++ b/app/assets/javascripts/discourse/app/components/user-info.hbs @@ -1,55 +1,56 @@ - - {{#if this.includeAvatar}} -
-
- {{avatar @user imageSize="large"}} - -
+{{#if this.includeAvatar}} +
+ - {{/if}} -
-
+
+{{/if}} +
+
+ {{#if this.includeLink}} + + + {{if this.nameFirst @user.name (format-username @user.username)}} + + + {{if this.nameFirst (format-username @user.username) @user.name}} + + + {{else}} {{if this.nameFirst @user.name (format-username @user.username)}} {{if this.nameFirst (format-username @user.username) @user.name}} - {{#if (and @showStatus @user.status)}} - - {{/if}} - - - -
-
{{@user.title}}
- {{#if (has-block)}} -
- {{yield}} -
{{/if}} -
- - + {{#if (and @showStatus @user.status)}} + + {{/if}} - +
+
{{@user.title}}
+ {{#if (has-block)}} +
+ {{yield}} +
+ {{/if}} +
- \ No newline at end of file + \ No newline at end of file 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 c0c0a2c4123..caaf678e009 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 @@ -33,10 +33,12 @@ module("Integration | Component | user-info", function (hooks) { ); this.set("includeLink", true); - assert.ok(exists(`a[href="/u/${this.currentUser.username}"]`)); + assert.ok(exists(`.name-line a[href="/u/${this.currentUser.username}"]`)); this.set("includeLink", false); - assert.notOk(exists(`a[href="/u/${this.currentUser.username}"]`)); + assert.notOk( + exists(`.name-line a[href="/u/${this.currentUser.username}"]`) + ); }); test("includeAvatar", async function (assert) { diff --git a/app/assets/stylesheets/common/components/user-info.scss b/app/assets/stylesheets/common/components/user-info.scss index 61fbf1bbc68..b86acbad83a 100644 --- a/app/assets/stylesheets/common/components/user-info.scss +++ b/app/assets/stylesheets/common/components/user-info.scss @@ -1,10 +1,7 @@ // Common styles for "user-info" component .user-info { - > a { - display: flex; - gap: 1em; - min-width: 0; - } + display: flex; + gap: 1em; .user-image-inner { position: relative; @@ -13,21 +10,22 @@ .user-detail { min-width: 0; - @include breakpoint(tablet) { + @include breakpoint(mobile-medium) { font-size: var(--font-down-1); } .name-line { - display: flex; - gap: 0.5em; - color: var(--primary-high); + > a { + display: flex; + gap: 0.5em; + color: var(--primary-high); + } .name, .username { @include ellipsis; } span:first-child { - flex: 0 0 auto; font-weight: bold; } } @@ -40,7 +38,6 @@ } .title { - margin-top: 0.25em; color: var(--primary-medium); } }