From 3050553fc2880f585e951542336b77af333e3cdf Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 27 Apr 2018 11:44:14 +0100 Subject: [PATCH] rename and change getInReplyTo Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/ReplyThread.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/views/elements/ReplyThread.js b/src/components/views/elements/ReplyThread.js index d6d6c9fb44..a7a026508c 100644 --- a/src/components/views/elements/ReplyThread.js +++ b/src/components/views/elements/ReplyThread.js @@ -83,7 +83,7 @@ export default class ReplyThread extends React.Component { async initialize() { const {parentEv} = this.props; - const inReplyTo = ReplyThread.getInReplyTo(parentEv); + const inReplyTo = ReplyThread.getParentEventId(parentEv); if (!inReplyTo) { this.setState({err: true}); return; @@ -104,7 +104,7 @@ export default class ReplyThread extends React.Component { async loadNextEvent() { if (this.unmounted) return; const ev = this.state.events[0]; - const inReplyTo = ReplyThread.getInReplyTo(ev); + const inReplyTo = ReplyThread.getParentEventId(ev); if (!inReplyTo) { this.setState({ @@ -146,13 +146,13 @@ export default class ReplyThread extends React.Component { dis.dispatch({action: 'focus_composer'}); } - static getInReplyTo(ev) { + static getParentEventId(ev) { if (!ev || ev.isRedacted()) return; const mRelatesTo = ev.getWireContent()['m.relates_to']; if (mRelatesTo && mRelatesTo['m.in_reply_to']) { const mInReplyTo = mRelatesTo['m.in_reply_to']; - if (mInReplyTo['event_id']) return mInReplyTo; + if (mInReplyTo && mInReplyTo['event_id']) return mInReplyTo['event_id']; } } @@ -173,7 +173,7 @@ export default class ReplyThread extends React.Component { if (!ev) return null; let {body, formatted_body: html} = ev.getContent(); - if (this.getInReplyTo(ev)) { + if (this.getParentEventId(ev)) { if (body) body = this.stripPlainReply(body); if (html) html = this.stripHTMLReply(html); } @@ -195,7 +195,6 @@ export default class ReplyThread extends React.Component { } break; } - case 'm.image': html = `
In reply to ${mxid}` + ``; @@ -245,7 +244,7 @@ export default class ReplyThread extends React.Component { } static getThread(parentEv, onWidgetLoad, ref) { - if (!SettingsStore.isFeatureEnabled("feature_rich_quoting") || !ReplyThread.getInReplyTo(parentEv)) { + if (!SettingsStore.isFeatureEnabled("feature_rich_quoting") || !ReplyThread.getParentEventId(parentEv)) { return ; } return
sent an image.