DEV: Make user card non-clickable for anon users: (#15938)

Make name / avatar non-clickable for anon users
This commit is contained in:
janzenisaac 2022-02-14 11:25:41 -06:00 committed by GitHub
parent 33d6ed60a4
commit ee050e5063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -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,
});
}

View File

@ -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)

View File

@ -76,3 +76,7 @@
.clickable {
cursor: pointer;
}
.non-clickable {
cursor: default;
}