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 @@ ...@@ -16,7 +16,7 @@
"messages.messageTitle": "Messages", "messages.messageTitle": "Messages",
"messages.profileComment": "{profileLink} commented on {commentLink}", "messages.profileComment": "{profileLink} commented on {commentLink}",
"messages.commentReply": "{profileLink} replied to your comment 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.profileSelf": "your profile",
"messages.projectComment": "{profileLink} commented on your project {commentLink}", "messages.projectComment": "{profileLink} commented on your project {commentLink}",
"messages.remixText": "{profileLink} remixed your project {remixedProjectLink} as {projectLink}", "messages.remixText": "{profileLink} remixed your project {remixedProjectLink} as {projectLink}",
......
var classNames = require('classnames'); var classNames = require('classnames');
var connect = require('react-redux').connect;
var FormattedMessage = require('react-intl').FormattedMessage; var FormattedMessage = require('react-intl').FormattedMessage;
var injectIntl = require('react-intl').injectIntl; var injectIntl = require('react-intl').injectIntl;
var React = require('react'); var React = require('react');
...@@ -55,16 +56,16 @@ var CommentMessage = injectIntl(React.createClass({ ...@@ -55,16 +56,16 @@ var CommentMessage = injectIntl(React.createClass({
if (typeof commentee !== 'undefined' && commentee === this.props.user.username) { if (typeof commentee !== 'undefined' && commentee === this.props.user.username) {
// is a profile comment, and is a reply // is a profile comment, and is a reply
if (this.props.objectTitle === this.props.user.username) { if (this.props.objectTitle === this.props.user.username) {
linkText = this.props.intl.formatMessage({ linkText = <FormattedMessage
id: 'messages.profileSelf' id='messages.profileSelf'
}); />;
} else { } else {
linkText = this.props.intl.formatMessage({ linkText = <FormattedMessage
id: 'messages.profileOther', id='messages.profileOther'
values: { values={{
username: this.props.objectTitle username: this.props.objectTitle
} }}
}); />;
} }
return <FormattedMessage return <FormattedMessage
id='messages.commentReply' id='messages.commentReply'
...@@ -158,4 +159,11 @@ var CommentMessage = injectIntl(React.createClass({ ...@@ -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