mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 10:41:45 +08:00
DEV: Make user card non-clickable for anon users: (#15938)
Make name / avatar non-clickable for anon users
This commit is contained in:
parent
33d6ed60a4
commit
ee050e5063
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -76,3 +76,7 @@
|
|||
.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.non-clickable {
|
||||
cursor: default;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user