diff options
author | nickago <ngonella@calpoly.edu> | 2015-07-13 14:56:54 -0700 |
---|---|---|
committer | nickago <ngonella@calpoly.edu> | 2015-07-13 14:56:54 -0700 |
commit | 3d56d9b2411fdf6db6228dee5dab3fad377a31c4 (patch) | |
tree | 17dda984d6df7867ac755146f6d633f96e801112 /web/react/components | |
parent | 6cc8788193630b802375669c72fab02220cb692a (diff) | |
download | chat-3d56d9b2411fdf6db6228dee5dab3fad377a31c4.tar.gz chat-3d56d9b2411fdf6db6228dee5dab3fad377a31c4.tar.bz2 chat-3d56d9b2411fdf6db6228dee5dab3fad377a31c4.zip |
Add processing for messageless image posts w/ pluralization
Diffstat (limited to 'web/react/components')
-rw-r--r-- | web/react/components/post_body.jsx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx index 7d5ef4d33..2febcfa04 100644 --- a/web/react/components/post_body.jsx +++ b/web/react/components/post_body.jsx @@ -71,11 +71,22 @@ module.exports = React.createClass({ name = <a className="theme" onClick={function(){ utils.searchForTerm(profile.username); }}>{profile.username}</a>; } - var message = parentPost.message; + var message = "" + if(parentPost.message) { + message = utils.replaceHtmlEntities(parentPost.message) + } else if (parentPost.filenames.length) { + message = <a parentPost.filenames[0].split('/').pop(); + + if (parentPost.filenames.length === 2) { + message += " plus 1 other file"; + } else if (parentPost.filenames.length > 2) { + message += " plus " + (parentPost.filenames.length - 1) + " other files"; + } + } comment = ( <p className="post-link"> - <span>Commented on {name}{apostrophe} message: <a className="theme" onClick={this.props.handleCommentClick}>{utils.replaceHtmlEntities(message)}</a></span> + <span>Commented on {name}{apostrophe} message: <a className="theme" onClick={this.props.handleCommentClick}>{message}</a></span> </p> ); |