diff options
Diffstat (limited to 'vnext/src/components')
-rw-r--r-- | vnext/src/components/Chat.js | 8 | ||||
-rw-r--r-- | vnext/src/components/Thread.js | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/vnext/src/components/Chat.js b/vnext/src/components/Chat.js index 66e7f804..916de003 100644 --- a/vnext/src/components/Chat.js +++ b/vnext/src/components/Chat.js @@ -33,6 +33,14 @@ export default class Chat extends React.Component { } } + onMessage = (msg) => { + if (msg.user.uname === this.props.match.params.user) { + this.setState({ + chats: [msg, ...this.state.chats] + }); + } + } + onSend = (template) => { pm(template.to.uname, template.body) .then(res => { diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index 63359ce0..0ec39d11 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -56,6 +56,13 @@ export default class Thread extends React.Component { active: msg.rid || 0 }) } + onReply = (msg) => { + if (msg.mid == this.state.msg.mid) { + this.setState({ + replies: [...this.state.replies, msg] + }) + } + } postComment = (template) => { const { mid, rid, body, attach } = template; comment(mid, rid, body, attach).then(res => { |