<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>
);
render() {
const { comment } = this.props;
+ const authorName = comment.authorName || comment.author;
return (
<div className="issue-comment">
- <div className="issue-comment-author" title={comment.authorName}>
+ <div className="issue-comment-author" title={authorName}>
<Avatar
className="little-spacer-right"
hash={comment.authorAvatar}
- name={comment.authorName}
+ name={authorName}
size={16}
/>
- {comment.authorName}
+ {authorName}
</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')
gravatarServerUrl: PropTypes.string.isRequired,
email: PropTypes.string,
hash: PropTypes.string,
- name: PropTypes.string.isRequired,
+ name: PropTypes.string,
size: PropTypes.number.isRequired,
className: PropTypes.string
};
render() {
if (!this.props.enableGravatar) {
+ if (!this.props.name) {
+ return null;
+ }
return this.renderFallback();
}
);
expect(avatar).toMatchSnapshot();
});
+
+it('do not fail when name is missing', () => {
+ const avatar = shallow(
+ <Avatar enableGravatar={false} gravatarServerUrl="" name={undefined} size={30} />
+ );
+ expect(avatar).toMatchSnapshot();
+});
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`do not fail when name is missing 1`] = `null`;
+
exports[`falls back to dummy avatar 1`] = `
<div
className="rounded"