Commit b7f1f5e9 authored by Matthew Taylor's avatar Matthew Taylor

fix comment message handling

add comment message to redux to access the current user, and fix the string
parent 6092bfe5
......@@ -16,7 +16,7 @@
"messages.messageTitle": "Messages",
"messages.profileComment": "{profileLink} commented on {commentLink}",
"messages.commentReply": "{profileLink} replied to your comment on {commentLink}",
"messages.profileOther": "{username}'s reply",
"messages.profileOther": "{username}'s profile",
"messages.profileSelf": "your profile",
"messages.projectComment": "{profileLink} commented on your project {commentLink}",
"messages.remixText": "{profileLink} remixed your project {remixedProjectLink} as {projectLink}",
......
var classNames = require('classnames');
var connect = require('react-redux').connect;
var FormattedMessage = require('react-intl').FormattedMessage;
var injectIntl = require('react-intl').injectIntl;
var React = require('react');
......@@ -55,16 +56,16 @@ var CommentMessage = injectIntl(React.createClass({
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'
});
linkText = <FormattedMessage
id='messages.profileSelf'
/>;
} else {
linkText = this.props.intl.formatMessage({
id: 'messages.profileOther',
values: {
linkText = <FormattedMessage
id='messages.profileOther'
values={{
username: this.props.objectTitle
}
});
}}
/>;
}
return <FormattedMessage
id='messages.commentReply'
......@@ -158,4 +159,11 @@ var CommentMessage = injectIntl(React.createClass({
}
}));
module.exports = CommentMessage;
var mapStateToProps = function (state) {
return {
user: state.session.session.user
};
};
var ConnectedCommentMessage = connect(mapStateToProps)(CommentMessage);
module.exports = ConnectedCommentMessage;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment