<Avatar
className="little-spacer-right"
hash={issue.assigneeAvatar}
- name={issue.assigneeName}
+ name={issue.assigneeName || issue.assignee}
size={16}
/>
</span>
)}
<span className="issue-meta-label">
- {issue.assignee ? issue.assigneeName : translate('unassigned')}
+ {issue.assignee ? issue.assigneeName || issue.assignee : translate('unassigned')}
</span>
</span>
);
<Avatar
className="little-spacer-right"
hash={comment.authorAvatar}
- name={comment.authorName}
+ name={comment.authorName || comment.author}
size={16}
/>
- {comment.authorName}
+ {comment.authorName || comment.author}
</div>
<div
className="issue-comment-text markdown"
<Avatar
className="little-spacer-left little-spacer-right"
hash={issue.assigneeAvatar}
- name={issue.assigneeName}
+ name={issue.assigneeName || issue.assignee}
size={16}
/>
- {issue.assigneeName}
+ {issue.assigneeName || issue.assignee}
</span>
) : (
translate('unassigned')
enableGravatar: boolean;
gravatarServerUrl: string;
hash?: string;
- name: string;
+ name?: string;
size: number;
}
function Avatar(props: Props) {
if (!props.enableGravatar || !props.hash) {
+ if (!props.name) {
+ return null;
+ }
return <GenericAvatar className={props.className} name={props.name} size={props.size} />;
}
return (
<img
+ alt={props.name}
className={classNames(props.className, 'rounded')}
+ height={props.size}
src={url}
width={props.size}
- height={props.size}
- alt={props.name}
/>
);
}
);
expect(avatar).toMatchSnapshot();
});
+
+it('do not fail when name is missing', () => {
+ const avatar = shallow(
+ <Avatar enableGravatar={false} gravatarServerUrl="" name={undefined} size={30} />
+ );
+ expect(avatar.getElement()).toBeNull();
+});