aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/ui')
-rw-r--r--vnext/src/ui/Thread.js55
-rw-r--r--vnext/src/ui/UserInfo.js9
2 files changed, 37 insertions, 27 deletions
diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js
index 92638104..a290acd7 100644
--- a/vnext/src/ui/Thread.js
+++ b/vnext/src/ui/Thread.js
@@ -46,19 +46,24 @@ function Comment({ msg, draft, visitor, active, setActive, onStartEditing, postC
}
}, []);
const userRef = useRef(author);
- useEffect(() => {
- isMounted = true;
- if (userRef.current.uri) {
- fetchUserUri(userRef.current.uri).then(response => {
- if (isMounted) {
- setAuthor(response.data);
- }
- });
+ useEffect(() => {
+ isMounted = true;
+ if (userRef.current.uri) {
+ fetchUserUri(userRef.current.uri).then(remote_user => {
+ if (isMounted) {
+ setAuthor({
+ uid: 0,
+ uname: remote_user.data.preferredUsername,
+ avatar: remote_user.data.icon && remote_user.data.icon.url,
+ uri: author.uri
+ });
}
- return () => {
- isMounted = false;
- };
- }, [msg.user]);
+ });
+ }
+ return () => {
+ isMounted = false;
+ };
+ }, [author.uri, msg.user]);
return (
<div style={chatItemStyle(visitor, msg)}>
<div className="msg-header">
@@ -105,10 +110,10 @@ function Comment({ msg, draft, visitor, active, setActive, onStartEditing, postC
}
</>
) : (
- <>
- <span>&nbsp;&middot;&nbsp;</span>{active === msg.rid || <Button>Reply</Button>}
- </>
- )
+ <>
+ <span>&nbsp;&middot;&nbsp;</span>{active === msg.rid || <Button>Reply</Button>}
+ </>
+ )
}
</div>
</div>
@@ -204,8 +209,8 @@ export default function Thread(props) {
{active === (message.rid || 0) && <MessageInput data={message} text={editing.body || ''} onSend={postComment}>Write a comment...</MessageInput>}
</Message>
) : (
- <Spinner />
- )
+ <Spinner />
+ )
}
{
message.replies && <ul id="replies">
@@ -215,13 +220,13 @@ export default function Thread(props) {
<Comment msg={msg} draft={msg.rid === editing.replyto ? editing.body : ''} visitor={props.visitor} active={active} setActive={setActive} onStartEditing={startEditing} postComment={postComment} />
</li>
)) : (
- <>
- {
- // @ts-ignore
- Array(loaders).fill().map((it, i) => <Spinner key={i} />)
- }
- </>
- )
+ <>
+ {
+ // @ts-ignore
+ Array(loaders).fill().map((it, i) => <Spinner key={i} />)
+ }
+ </>
+ )
}
</ul>
}
diff --git a/vnext/src/ui/UserInfo.js b/vnext/src/ui/UserInfo.js
index 5fe244ea..9a663829 100644
--- a/vnext/src/ui/UserInfo.js
+++ b/vnext/src/ui/UserInfo.js
@@ -100,9 +100,14 @@ export function UserLink(props) {
useEffect(() => {
isMounted = true;
if (userRef.current.uri) {
- fetchUserUri(userRef.current.uri).then(response => {
+ fetchUserUri(userRef.current.uri).then(remote_user => {
if (isMounted) {
- setUser(response.data);
+ setUser({
+ uid: 0,
+ uname: remote_user.data.preferredUsername,
+ avatar: remote_user.data.icon && remote_user.data.icon.url,
+ uri: userRef.current.uri
+ });
}
}).catch(reason => {
// TODO: debug logging