From d7cdcf082fab6c0cb7c2fe4bed821bd1a8000e69 Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Mon, 8 Feb 2016 07:26:10 -0500
Subject: Convering client to react-router.

---
 web/react/components/user_profile.jsx | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

(limited to 'web/react/components/user_profile.jsx')

diff --git a/web/react/components/user_profile.jsx b/web/react/components/user_profile.jsx
index 31b2b9907..e7a286b77 100644
--- a/web/react/components/user_profile.jsx
+++ b/web/react/components/user_profile.jsx
@@ -26,22 +26,27 @@ export default class UserProfile extends React.Component {
         }
     }
     render() {
-        var name = Utils.displayUsername(this.props.user.id);
-        if (this.props.overwriteName) {
-            name = this.props.overwriteName;
-        } else if (!name) {
-            name = '...';
+        let name = '...';
+        let email = '';
+        let profileImg = '';
+        if (this.props.user) {
+            name = Utils.displayUsername(this.props.user.id);
+            email = this.props.user.email;
+            profileImg = '/api/v1/users/' + this.props.user.id + '/image?time=' + this.props.user.update_at;
         }
 
-        if (this.props.disablePopover) {
-            return <div>{name}</div>;
+        if (this.props.overwriteName) {
+            name = this.props.overwriteName;
         }
 
-        var profileImg = '/api/v1/users/' + this.props.user.id + '/image?time=' + this.props.user.update_at + '&' + Utils.getSessionIndex();
         if (this.props.overwriteImage) {
             profileImg = this.props.overwriteImage;
         }
 
+        if (this.props.disablePopover) {
+            return <div>{name}</div>;
+        }
+
         var dataContent = [];
         dataContent.push(
             <img
@@ -69,14 +74,14 @@ export default class UserProfile extends React.Component {
             dataContent.push(
                 <div
                     data-toggle='tooltip'
-                    title={this.props.user.email}
+                    title={email}
                     key='user-popover-email'
                 >
                     <a
-                        href={'mailto:' + this.props.user.email}
+                        href={'mailto:' + email}
                         className='text-nowrap text-lowercase user-popover__email'
                     >
-                        {this.props.user.email}
+                        {email}
                     </a>
                 </div>
             );
@@ -114,7 +119,7 @@ UserProfile.defaultProps = {
     disablePopover: false
 };
 UserProfile.propTypes = {
-    user: React.PropTypes.object.isRequired,
+    user: React.PropTypes.object,
     overwriteName: React.PropTypes.string,
     overwriteImage: React.PropTypes.string,
     disablePopover: React.PropTypes.bool
-- 
cgit v1.2.3-1-g7c22

