<commit_before>
import React from "react";
import Component from "ui-lib/component";
import theme from "./theme.scss";

class UserAvatar extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        const imgUri = `/userrepo/user/${this.props.userId}/avatar?binary=true`;

        return (
            <img
                src={imgUri}
                className={this.props.className}
            />
        );
    }
}

UserAvatar.defaultProps = {
    className: `${theme.avatar} ${theme.avatarLarge}`
};

UserAvatar.propTypes = {
    className: React.PropTypes.string,
    theme: React.PropTypes.object,
    userId: React.PropTypes.string.isRequired,
    meta: React.PropTypes.object
};

export default UserAvatar;<commit_msg>UI: UserAvatar only requests avatar if it exists<commit_after>
import React from "react";
import Component from "ui-lib/component";
import theme from "./theme.scss";

class UserAvatar extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        let avatar = null;
        if (this.props.meta) {
            const imgUri = `/userrepo/user/${this.props.userId}/avatar?binary=true`;

            avatar = (
                <img
                    src={imgUri}
                    className={this.props.className}
                />
            );
        }

        return avatar;
    }
}

UserAvatar.defaultProps = {
    className: `${theme.avatar} ${theme.avatarLarge}`
};

UserAvatar.propTypes = {
    className: React.PropTypes.string,
    theme: React.PropTypes.object,
    userId: React.PropTypes.string.isRequired,
    meta: React.PropTypes.object
};

export default UserAvatar;
{'fraction_non_alphanumeric': 0.12195121951219512, 'fraction_numerical': 0.0, 'mean_word_length': 2.28515625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1563102', 'n_tokens_mistral': 501, 'n_tokens_neox': 495, 'n_words': 99}