From 9fca35cad531fe040155ba460577b0c3eba6b24e Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Thu, 2 Jul 2015 11:13:38 -0700 Subject: Added additional class to the markup indicating if the post came from the current user --- web/react/components/post.jsx | 12 +++++++++--- web/react/components/post_right.jsx | 20 +++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'web') diff --git a/web/react/components/post.jsx b/web/react/components/post.jsx index afe978495..e877a2213 100644 --- a/web/react/components/post.jsx +++ b/web/react/components/post.jsx @@ -6,6 +6,7 @@ var PostBody = require('./post_body.jsx'); var PostInfo = require('./post_info.jsx'); var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); var Constants = require('../utils/constants.jsx'); +var UserStore = require('../stores/user_store.jsx'); var ActionTypes = Constants.ActionTypes; module.exports = React.createClass({ @@ -56,7 +57,7 @@ module.exports = React.createClass({ var error = this.state.error ?
: null; - if(this.props.sameRoot){ + if (this.props.sameRoot){ rootUser = "same--root"; } else { @@ -64,13 +65,18 @@ module.exports = React.createClass({ } var postType = ""; - if(type != "Post"){ + if (type != "Post"){ postType = "post--comment"; } + var currentUser = ""; + if (UserStore.getCurrentId() === post.user_id) { + currentUser = "current--user"; + } + return (
-
+
{ !this.props.hideProfilePic ?
diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx index 43be60afa..15a058c5f 100644 --- a/web/react/components/post_right.jsx +++ b/web/react/components/post_right.jsx @@ -68,9 +68,14 @@ RootPost = React.createClass({ var filenames = this.props.post.filenames; var isOwner = UserStore.getCurrentId() == this.props.post.user_id; - var type = "Post" + var type = "Post"; if (this.props.post.root_id.length > 0) { - type = "Comment" + type = "Comment"; + } + + var currentUser = ""; + if (UserStore.getCurrentId() === this.props.post.user_id) { + currentUser = "current--user"; } if (filenames) { @@ -84,7 +89,7 @@ RootPost = React.createClass({ if (fileSplit.length < 2) continue; var ext = fileSplit[fileSplit.length-1]; - fileSplit.splice(fileSplit.length-1,1) + fileSplit.splice(fileSplit.length-1,1); var filePath = fileSplit.join('.'); var filename = filePath.split('/')[filePath.split('/').length-1]; @@ -111,7 +116,7 @@ RootPost = React.createClass({ } return ( -
+
@@ -170,6 +175,11 @@ CommentPost = React.createClass({ var commentClass = "post"; + var currentUser = ""; + if (UserStore.getCurrentId() === this.props.post.user_id) { + currentUser = "current--user"; + } + var postImageModalId = "rhs_comment_view_image_modal_" + this.props.post.id; var filenames = this.props.post.filenames; var isOwner = UserStore.getCurrentId() == this.props.post.user_id; @@ -219,7 +229,7 @@ CommentPost = React.createClass({ var message = utils.textToJsx(this.props.post.message); return ( -
+
-- cgit v1.2.3-1-g7c22