diff --git a/app/assets/javascripts/discourse/app/widgets/post.js b/app/assets/javascripts/discourse/app/widgets/post.js index ca41e8eabe..a32d87d730 100644 --- a/app/assets/javascripts/discourse/app/widgets/post.js +++ b/app/assets/javascripts/discourse/app/widgets/post.js @@ -173,6 +173,8 @@ createWidget("post-avatar", { html(attrs) { let body; + let hideFromAnonUser = + this.siteSettings.hide_user_profiles_from_public && !this.currentUser; if (!attrs.user_id) { body = iconNode("far-trash-alt", { class: "deleted-user-avatar" }); } else { @@ -181,7 +183,7 @@ createWidget("post-avatar", { username: attrs.username, name: attrs.name, url: attrs.usernameUrl, - className: "main-avatar", + className: `main-avatar ${hideFromAnonUser ? "non-clickable" : ""}`, hideTitle: true, }); } diff --git a/app/assets/javascripts/discourse/app/widgets/poster-name.js b/app/assets/javascripts/discourse/app/widgets/poster-name.js index 441fda53fd..2308b77155 100644 --- a/app/assets/javascripts/discourse/app/widgets/poster-name.js +++ b/app/assets/javascripts/discourse/app/widgets/poster-name.js @@ -58,6 +58,12 @@ export default createWidget("poster-name", { attributes: { href: attrs.usernameUrl, "data-user-card": attrs.username, + class: `${ + this.siteSettings.hide_user_profiles_from_public && + !this.currentUser + ? "non-clickable" + : "" + }`, }, }, formatUsername(text) diff --git a/app/assets/stylesheets/common/foundation/helpers.scss b/app/assets/stylesheets/common/foundation/helpers.scss index e06dda77a0..2fc2324e27 100644 --- a/app/assets/stylesheets/common/foundation/helpers.scss +++ b/app/assets/stylesheets/common/foundation/helpers.scss @@ -76,3 +76,7 @@ .clickable { cursor: pointer; } + +.non-clickable { + cursor: default; +}