summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-07-15 09:53:26 -0800
committerCorey Hulen <corey@hulen.com>2015-07-15 09:53:26 -0800
commited06e7fbbcfd891a86d3c439df64fab5759598be (patch)
tree3c8b3fc18d2b148389a9a95d0620c931b94aa9fa /web
parent593556d30d4d85abae30ca4755b817d618a318c1 (diff)
parentfa4ac0c7890aa148122407feb2575470336099e1 (diff)
downloadchat-ed06e7fbbcfd891a86d3c439df64fab5759598be.tar.gz
chat-ed06e7fbbcfd891a86d3c439df64fab5759598be.tar.bz2
chat-ed06e7fbbcfd891a86d3c439df64fab5759598be.zip
Merge pull request #176 from nickago/MM-1400
MM-1400 Add processing for message-less image posts w/ pluralization
Diffstat (limited to 'web')
-rw-r--r--web/react/components/post_body.jsx15
1 files changed, 13 insertions, 2 deletions
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx
index cf542a98f..d9678df30 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 = 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>
);