<commit_before>var classNames = require('classnames');
var FormattedMessage = require('react-intl').FormattedMessage;
var injectIntl = require('react-intl').injectIntl;
var React = require('react');

var Comment = require('../../../components/comment/comment.jsx');
var FlexRow = require('../../../components/flex-row/flex-row.jsx');
var SocialMessage = require('../../../components/social-message/social-message.jsx');

var CommentMessage = injectIntl(React.createClass({
    type: 'CommentMessage',
    propTypes: {
        actorUsername: React.PropTypes.string.isRequired,
        actorId: React.PropTypes.number.isRequired,
        objectType: React.PropTypes.oneOf([0, 1, 2]).isRequired,
        objectId: React.PropTypes.number.isRequired,
        commentId: React.PropTypes.number.isRequired,
        commentText: React.PropTypes.string.isRequired,
        commentDateTime: React.PropTypes.string.isRequired,
        objectTitle: React.PropTypes.string,
        commentee: React.PropTypes.string
    },
    getObjectLink: function (objectType, commentId, objectId) {
        switch (objectType) {
        case 0:
            return '/projects/' + objectId + '/#comments-' + commentId;
        case 1:
            return '/users/' + objectId + '/#comments-' + commentId;
        case 2:
            return '/studios/' + objectId + '/comments/#comments-' + commentId;
        }
    },
    getMessageText: function (objectType, commentee) {
        var actorLink = '/users/' + this.props.actorUsername + '/';
        if (objectType === 2) {
            // studio comment notifications only occur for direct replies
            if (typeof commentee !== 'undefined' && commentee === this.props.user.username) {
                var commentLink = '/studios/' + this.props.objectId + '/comments/#comments-' + this.props.commentId;
                return <FormattedMessage
                    id='messages.studioCommentReply'
                    values={{
                        profileLink: <a
                            href={actorLink}
                            className="social-messages-profile-link"
                        >
                            {this.props.actorUsername}
                        </a>,
                        commentLink: <a href={commentLink}>{this.props.objectTitle}</a>
                    }}
                />;
            }
        } else if (objectType === 1) {
            var profileLink = '/users/' + this.props.objectId + '/#comments-' + this.props.commentId;
            var linkText = '';
            if (typeof commentee !== 'undefined' && commentee === this.props.user.username) {
                // is a profile comment, and is a reply
                if (this.props.objectTitle === this.props.user.username) {
                    linkText = this.props.intl.formatMessage({
                        id: 'messages.profileSelf'
                    });
                } else {
                    linkText = this.props.intl.formatMessage({
                        id: 'messages.profileOther',
                        values: {
                            username: this.props.objectId
                        }
                    });<commit_msg>Use username, not user id, for profile link<commit_after>var classNames = require('classnames');
var FormattedMessage = require('react-intl').FormattedMessage;
var injectIntl = require('react-intl').injectIntl;
var React = require('react');

var Comment = require('../../../components/comment/comment.jsx');
var FlexRow = require('../../../components/flex-row/flex-row.jsx');
var SocialMessage = require('../../../components/social-message/social-message.jsx');

var CommentMessage = injectIntl(React.createClass({
    type: 'CommentMessage',
    propTypes: {
        actorUsername: React.PropTypes.string.isRequired,
        actorId: React.PropTypes.number.isRequired,
        objectType: React.PropTypes.oneOf([0, 1, 2]).isRequired,
        objectId: React.PropTypes.number.isRequired,
        commentId: React.PropTypes.number.isRequired,
        commentText: React.PropTypes.string.isRequired,
        commentDateTime: React.PropTypes.string.isRequired,
        objectTitle: React.PropTypes.string,
        commentee: React.PropTypes.string
    },
    getObjectLink: function (objectType, commentId, objectId) {
        switch (objectType) {
        case 0:
            return '/projects/' + objectId + '/#comments-' + commentId;
        case 1:
            return '/users/' + objectId + '/#comments-' + commentId;
        case 2:
            return '/studios/' + objectId + '/comments/#comments-' + commentId;
        }
    },
    getMessageText: function (objectType, commentee) {
        var actorLink = '/users/' + this.props.actorUsername + '/';
        if (objectType === 2) {
            // studio comment notifications only occur for direct replies
            if (typeof commentee !== 'undefined' && commentee === this.props.user.username) {
                var commentLink = '/studios/' + this.props.objectId + '/comments/#comments-' + this.props.commentId;
                return <FormattedMessage
                    id='messages.studioCommentReply'
                    values={{
                        profileLink: <a
                            href={actorLink}
                            className="social-messages-profile-link"
                        >
                            {this.props.actorUsername}
                        </a>,
                        commentLink: <a href={commentLink}>{this.props.objectTitle}</a>
                    }}
                />;
            }
        } else if (objectType === 1) {
            var profileLink = '/users/' + this.props.objectTitle + '/#comments-' + this.props.commentId;
            var linkText = '';
            if (typeof commentee !== 'undefined' && commentee === this.props.user.username) {
                // is a profile comment, and is a reply
                if (this.props.objectTitle === this.props.user.username) {
                    linkText = this.props.intl.formatMessage({
                        id: 'messages.profileSelf'
                    });
                } else {
                    linkText = this.props.intl.formatMessage({
                        id: 'messages.profileOther',
                        values: {
                            username: this.props.objectId
                        }
                    });
{'fraction_non_alphanumeric': 0.1271226047670977, 'fraction_numerical': 0.0024926000934725034, 'mean_word_length': 1.7180355630821338, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '4327424', 'n_tokens_mistral': 1654, 'n_tokens_neox': 1585, 'n_words': 327}