diff options
-rw-r--r-- | vnext/src/ui/Comment.js | 4 | ||||
-rw-r--r-- | vnext/src/ui/PM.js | 2 | ||||
-rw-r--r-- | vnext/src/ui/Thread.js | 4 | ||||
-rw-r--r-- | vnext/src/ui/helpers/BubbleStyle.js | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/vnext/src/ui/Comment.js b/vnext/src/ui/Comment.js index 6ba34ff0..3a3f4429 100644 --- a/vnext/src/ui/Comment.js +++ b/vnext/src/ui/Comment.js @@ -53,7 +53,7 @@ export default function Comment({ msg, draft, active, setActive, onStartEditing, </div> { msg.body && - <div className={visitor.uid === msg.user.uid ? 'msg-bubble msg-bubble-my' : 'msg-bubble'}> + <div className={visitor && visitor.uid === msg.user.uid ? 'msg-bubble msg-bubble-my' : 'msg-bubble'}> <div ref={msgRef}> <p dangerouslySetInnerHTML={{ __html: format(msg.body, msg.mid.toString(), (msg.tags || []).indexOf('code') >= 0) }} /> </div> @@ -71,7 +71,7 @@ export default function Comment({ msg, draft, active, setActive, onStartEditing, { active === msg.rid && <MessageInput text={draft || ''} onSend={postComment} placeholder="Write a comment..." /> } - {visitor.uid > 0 && + {visitor && visitor.uid > 0 && <div className="msg-links"> { visitor.uid > 0 ? ( diff --git a/vnext/src/ui/PM.js b/vnext/src/ui/PM.js index 3aa877b1..b0426ea3 100644 --- a/vnext/src/ui/PM.js +++ b/vnext/src/ui/PM.js @@ -12,7 +12,7 @@ function PM(props) { <li> <div style={chatItemStyle(visitor, chat)}> <Avatar user={chat.user} /> - <div className={visitor.uid === chat.user.uid ? 'msg-bubble msg-bubble-my' : 'msg-bubble'}> + <div className={visitor && visitor.uid === chat.user.uid ? 'msg-bubble msg-bubble-my' : 'msg-bubble'}> <p dangerouslySetInnerHTML={{ __html: format(chat.body, '0', false) }} /> </div> </div> diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js index 61474153..4fc049c3 100644 --- a/vnext/src/ui/Thread.js +++ b/vnext/src/ui/Thread.js @@ -28,7 +28,7 @@ export default function Thread(props) { const [editing, setEditing] = useState(emptyMessage) const [visitor] = useVisitor() - const [hash] = useState(visitor.hash) + const [hash] = useState(visitor?.hash) const { mid } = params let loadReplies = useCallback(() => { @@ -131,7 +131,7 @@ export default function Thread(props) { { message.mid ? ( <Message key={message.mid} data={message} isThread={true} onToggleSubscription={handleSubsciptionToggle}> - {active === (message.rid || 0) && visitor.uid > 0 && <MessageInput data={message} text={editing.body || ''} onSend={postComment}>Write a comment...</MessageInput>} + {active === (message.rid || 0) && visitor && visitor.uid > 0 && <MessageInput data={message} text={editing.body || ''} onSend={postComment}>Write a comment...</MessageInput>} </Message> ) : ( <Spinner /> diff --git a/vnext/src/ui/helpers/BubbleStyle.js b/vnext/src/ui/helpers/BubbleStyle.js index def60b62..3b21d1fb 100644 --- a/vnext/src/ui/helpers/BubbleStyle.js +++ b/vnext/src/ui/helpers/BubbleStyle.js @@ -5,7 +5,7 @@ */ export function chatItemStyle(me, msg) { const user = msg.user - const isMe = me.uid === user.uid + const isMe = me && me.uid === user.uid const alignment = isMe ? 'flex-end' : 'flex-start' return { padding: '3px 6px', |