mirror of https://github.com/vector-im/riot-web
rename and change getInReplyTo
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
ca766df598
commit
3050553fc2
|
@ -83,7 +83,7 @@ export default class ReplyThread extends React.Component {
|
||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
const {parentEv} = this.props;
|
const {parentEv} = this.props;
|
||||||
const inReplyTo = ReplyThread.getInReplyTo(parentEv);
|
const inReplyTo = ReplyThread.getParentEventId(parentEv);
|
||||||
if (!inReplyTo) {
|
if (!inReplyTo) {
|
||||||
this.setState({err: true});
|
this.setState({err: true});
|
||||||
return;
|
return;
|
||||||
|
@ -104,7 +104,7 @@ export default class ReplyThread extends React.Component {
|
||||||
async loadNextEvent() {
|
async loadNextEvent() {
|
||||||
if (this.unmounted) return;
|
if (this.unmounted) return;
|
||||||
const ev = this.state.events[0];
|
const ev = this.state.events[0];
|
||||||
const inReplyTo = ReplyThread.getInReplyTo(ev);
|
const inReplyTo = ReplyThread.getParentEventId(ev);
|
||||||
|
|
||||||
if (!inReplyTo) {
|
if (!inReplyTo) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -146,13 +146,13 @@ export default class ReplyThread extends React.Component {
|
||||||
dis.dispatch({action: 'focus_composer'});
|
dis.dispatch({action: 'focus_composer'});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInReplyTo(ev) {
|
static getParentEventId(ev) {
|
||||||
if (!ev || ev.isRedacted()) return;
|
if (!ev || ev.isRedacted()) return;
|
||||||
|
|
||||||
const mRelatesTo = ev.getWireContent()['m.relates_to'];
|
const mRelatesTo = ev.getWireContent()['m.relates_to'];
|
||||||
if (mRelatesTo && mRelatesTo['m.in_reply_to']) {
|
if (mRelatesTo && mRelatesTo['m.in_reply_to']) {
|
||||||
const mInReplyTo = 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;
|
if (!ev) return null;
|
||||||
|
|
||||||
let {body, formatted_body: html} = ev.getContent();
|
let {body, formatted_body: html} = ev.getContent();
|
||||||
if (this.getInReplyTo(ev)) {
|
if (this.getParentEventId(ev)) {
|
||||||
if (body) body = this.stripPlainReply(body);
|
if (body) body = this.stripPlainReply(body);
|
||||||
if (html) html = this.stripHTMLReply(html);
|
if (html) html = this.stripHTMLReply(html);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,6 @@ export default class ReplyThread extends React.Component {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'm.image':
|
case 'm.image':
|
||||||
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
|
||||||
+ `<br>sent an image.</blockquote>`;
|
+ `<br>sent an image.</blockquote>`;
|
||||||
|
@ -245,7 +244,7 @@ export default class ReplyThread extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
static getThread(parentEv, onWidgetLoad, ref) {
|
static getThread(parentEv, onWidgetLoad, ref) {
|
||||||
if (!SettingsStore.isFeatureEnabled("feature_rich_quoting") || !ReplyThread.getInReplyTo(parentEv)) {
|
if (!SettingsStore.isFeatureEnabled("feature_rich_quoting") || !ReplyThread.getParentEventId(parentEv)) {
|
||||||
return <div />;
|
return <div />;
|
||||||
}
|
}
|
||||||
return <ReplyThread parentEv={parentEv} onWidgetLoad={onWidgetLoad} ref={ref} />;
|
return <ReplyThread parentEv={parentEv} onWidgetLoad={onWidgetLoad} ref={ref} />;
|
||||||
|
|
Loading…
Reference in New Issue