Skip to content

A platform for community discussion. Free, open, simple.

FIX: Don't show empty user stats in the card when profile is hidden

Robin Ward2178f7768fe7
diff --git a/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs b/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs
index 59c1891fb1d..39aed70a289 100644
--- a/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs
+++ b/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs
@@ -116,30 +116,32 @@
{{/if}}
{{#if user}}
- <div class="metadata">
- {{#if user.last_posted_at}}
- <h3><span class='desc'>{{i18n 'last_post'}}</span> {{format-date user.last_posted_at leaveAgo="true"}}</h3>
- {{/if}}
- <h3><span class='desc'>{{i18n 'joined'}}</span> {{format-date user.created_at leaveAgo="true"}}</h3>
- <h3 title="{{timeReadTooltip}}">
- <span class='desc'>{{i18n 'time_read'}}</span>
- {{format-duration user.time_read}}
- {{#if showRecentTimeRead}}
- <span>({{i18n 'time_read_recently' time_read=recentTimeRead}})</span>
+ {{#unless user.profile_hidden}}
+ <div class="metadata">
+ {{#if user.last_posted_at}}
+ <h3><span class='desc'>{{i18n 'last_post'}}</span> {{format-date user.last_posted_at leaveAgo="true"}}</h3>
{{/if}}
- </h3>
- {{#if showCheckEmail}}
- <h3 class="email">
- {{d-icon "envelope-o" title="user.email.title"}}
- {{#if user.email}}
- {{user.email}}
- {{else}}
- {{d-button action="checkEmail" actionParam=user icon="envelope-o" label="admin.users.check_email.text" class="btn-primary"}}
+ <h3><span class='desc'>{{i18n 'joined'}}</span> {{format-date user.created_at leaveAgo="true"}}</h3>
+ <h3 title="{{timeReadTooltip}}">
+ <span class='desc'>{{i18n 'time_read'}}</span>
+ {{format-duration user.time_read}}
+ {{#if showRecentTimeRead}}
+ <span>({{i18n 'time_read_recently' time_read=recentTimeRead}})</span>
{{/if}}
</h3>
- {{/if}}
- {{plugin-outlet name="user-card-metadata" args=(hash user=user)}}
- </div>
+ {{#if showCheckEmail}}
+ <h3 class="email">
+ {{d-icon "envelope-o" title="user.email.title"}}
+ {{#if user.email}}
+ {{user.email}}
+ {{else}}
+ {{d-button action="checkEmail" actionParam=user icon="envelope-o" label="admin.users.check_email.text" class="btn-primary"}}
+ {{/if}}
+ </h3>
+ {{/if}}
+ {{plugin-outlet name="user-card-metadata" args=(hash user=user)}}
+ </div>
+ {{/unless}}
{{/if}}
{{#if publicUserFields}}