aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/Thread.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/ui/Thread.js')
-rw-r--r--vnext/src/ui/Thread.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js
index b625ecad..30fa0723 100644
--- a/vnext/src/ui/Thread.js
+++ b/vnext/src/ui/Thread.js
@@ -12,13 +12,16 @@ import Button from './Button';
import { format, embedUrls } from '../utils/embed';
-import { getMessages, comment, markReadTracker } from '../api';
+import { getMessages, comment, markReadTracker, fetchUserUri } from '../api';
import './Thread.css';
+let isMounted;
+
function Comment({ msg, visitor, active, setActive, postComment }) {
const embedRef = useRef();
const msgRef = useRef();
+ const [author, setAuthor] = useState(msg.user);
useEffect(() => {
if (msgRef.current) {
embedUrls(msgRef.current.querySelectorAll('a'), embedRef.current);
@@ -27,10 +30,23 @@ function Comment({ msg, visitor, active, setActive, postComment }) {
}
}
}, []);
+ useEffect(() => {
+ isMounted = true;
+ if (author.uri) {
+ fetchUserUri(author.uri).then(response => {
+ if (isMounted) {
+ setAuthor(response.data);
+ }
+ });
+ }
+ return () => {
+ isMounted = false;
+ };
+}, [author.uri]);
return (
<div>
<div className="msg-header" style={{ padding: '6px', display: 'flex', alignItems: 'flex-start' }}>
- <Avatar user={msg.user}>
+ <Avatar user={author} link={author.uri}>
<div className="msg-ts">
{msg.replyto > 0 &&
(