mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 12:53:13 +03:00
Added support for deleted members' comments
fixes https://github.com/TryGhost/Team/issues/1690
This commit is contained in:
parent
6768ae2d55
commit
0da39ddeeb
@ -44,6 +44,10 @@ const Avatar = (props) => {
|
||||
};
|
||||
|
||||
const commentGetInitials = () => {
|
||||
if (props.comment && !props.comment.member) {
|
||||
return getInitials('Deleted member');
|
||||
}
|
||||
|
||||
let commentMember = (props.comment ? props.comment.member : member);
|
||||
|
||||
if (!commentMember || !commentMember.name) {
|
||||
@ -66,7 +70,7 @@ const Avatar = (props) => {
|
||||
<div className={`flex justify-center items-center rounded-full ${dimensionClasses}`} style={avatarStyle}>
|
||||
<p className={`text-white font-sans font-semibold ${initialsClasses}`}>{ commentGetInitials() }</p>
|
||||
</div>
|
||||
<img className={`absolute top-0 left-0 rounded-full ${dimensionClasses}`} src={commentMember.avatar_image} alt="Avatar"/>
|
||||
{commentMember && <img className={`absolute top-0 left-0 rounded-full ${dimensionClasses}`} src={commentMember.avatar_image} alt="Avatar"/>}
|
||||
</figure>
|
||||
);
|
||||
};
|
||||
|
@ -47,7 +47,7 @@ const Comment = (props) => {
|
||||
<div className="flex justify-start items-center">
|
||||
<Avatar comment={comment} saturation={avatarSaturation} />
|
||||
<div className="ml-3">
|
||||
<h4 className="text-lg font-sans font-semibold mb-1 tracking-tight dark:text-[rgba(255,255,255,0.85)]">{comment.member.name ? comment.member.name : 'Anonymous'}</h4>
|
||||
<h4 className="text-lg font-sans font-semibold mb-1 tracking-tight dark:text-[rgba(255,255,255,0.85)]">{!comment.member ? 'Deleted member' : (comment.member.name ? comment.member.name : 'Anonymous')}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`ml-14 mb-4 pr-4 font-sans leading-normal ${isNotPublished ? 'text-neutral-400' : 'text-neutral-900'} dark:text-[rgba(255,255,255,0.85)]`}>
|
||||
|
@ -99,10 +99,10 @@ export function getInitials(name) {
|
||||
}
|
||||
|
||||
if (parts.length === 1) {
|
||||
return parts[0].substring(0, 1);
|
||||
return parts[0].substring(0, 1).toLocaleUpperCase();
|
||||
}
|
||||
|
||||
return parts[0].substring(0, 1) + parts[parts.length - 1].substring(0, 1);
|
||||
return parts[0].substring(0, 1).toLocaleUpperCase() + parts[parts.length - 1].substring(0, 1).toLocaleUpperCase();
|
||||
}
|
||||
|
||||
export function getBundledCssLink({appVersion}) {
|
||||
|
Loading…
Reference in New Issue
Block a user