From 00a17e34b365c1381370a8d0f0ba9437af4f10ef Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 23 Jul 2015 17:05:29 -0400 Subject: Cleaned up references to the current post in post_right.jsx --- web/react/components/post_right.jsx | 63 +++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx index 861f03673..1d09842f3 100644 --- a/web/react/components/post_right.jsx +++ b/web/react/components/post_right.jsx @@ -56,18 +56,19 @@ RhsHeaderPost = React.createClass({ RootPost = React.createClass({ render: function() { - var message = utils.textToJsx(this.props.post.message); - var isOwner = UserStore.getCurrentId() == this.props.post.user_id; - var timestamp = UserStore.getProfile(this.props.post.user_id).update_at; - var channel = ChannelStore.get(this.props.post.channel_id); + var post = this.props.post; + var message = utils.textToJsx(post.message); + var isOwner = UserStore.getCurrentId() == post.user_id; + var timestamp = UserStore.getProfile(post.user_id).update_at; + var channel = ChannelStore.get(post.channel_id); var type = "Post"; - if (this.props.post.root_id.length > 0) { + if (post.root_id.length > 0) { type = "Comment"; } var currentUserCss = ""; - if (UserStore.getCurrentId() === this.props.post.user_id) { + if (UserStore.getCurrentId() === post.user_id) { currentUserCss = "current--user"; } @@ -79,20 +80,20 @@ RootPost = React.createClass({
{ channelName }
- +
    -
  • -
  • +
  • +
  • { isOwner ? : "" } @@ -101,12 +102,12 @@ RootPost = React.createClass({

{message}

- { this.props.post.filenames && this.props.post.filenames.length > 0 ? + { post.filenames && post.filenames.length > 0 ? + postId={post.id} + channelId={post.channel_id} + userId={post.user_id} + filenames={post.filenames} /> : "" }
@@ -118,39 +119,41 @@ RootPost = React.createClass({ CommentPost = React.createClass({ render: function() { + var post = this.props.post; + var commentClass = "post"; var currentUserCss = ""; - if (UserStore.getCurrentId() === this.props.post.user_id) { + if (UserStore.getCurrentId() === post.user_id) { currentUserCss = "current--user"; } - var isOwner = UserStore.getCurrentId() == this.props.post.user_id; + var isOwner = UserStore.getCurrentId() == post.user_id; var type = "Post" - if (this.props.post.root_id.length > 0) { + if (post.root_id.length > 0) { type = "Comment" } - var message = utils.textToJsx(this.props.post.message); + var message = utils.textToJsx(post.message); var timestamp = UserStore.getCurrentUser().update_at; return (
- +
    -
  • -
  • +
  • +
  • { isOwner ? : "" } @@ -158,12 +161,12 @@ CommentPost = React.createClass({

{message}

- { this.props.post.filenames && this.props.post.filenames.length > 0 ? + { post.filenames && post.filenames.length > 0 ? + postId={post.id} + channelId={post.channel_id} + userId={post.user_id} + filenames={post.filenames} /> : "" }
-- cgit v1.2.3-1-g7c22