Allow collapsing ReplyThread from MessageContextMenu

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2018-04-13 12:28:58 +01:00
parent 8b1e411d6b
commit a90bd6cd4f
No known key found for this signature in database
GPG key ID: 3F879DA5AD802A5E
2 changed files with 20 additions and 6 deletions

View file

@ -52,6 +52,8 @@ export default class ReplyThread extends React.Component {
};
this.onQuoteClick = this.onQuoteClick.bind(this);
this.canCollapse = this.canCollapse.bind(this);
this.collapse = this.collapse.bind(this);
}
componentWillMount() {
@ -64,6 +66,14 @@ export default class ReplyThread extends React.Component {
this.unmounted = true;
}
canCollapse() {
return this.state.events.length > 1;
}
collapse() {
this.initialize();
}
async initialize() {
const {parentEv} = this.props;
const inReplyTo = ReplyThread.getInReplyTo(parentEv);
@ -227,11 +237,11 @@ export default class ReplyThread extends React.Component {
};
}
static getQuote(parentEv, onWidgetLoad) {
static getThread(parentEv, onWidgetLoad, ref) {
if (!SettingsStore.isFeatureEnabled("feature_rich_quoting") || !ReplyThread.getInReplyTo(parentEv)) {
return <div />;
}
return <ReplyThread parentEv={parentEv} onWidgetLoad={onWidgetLoad} />;
return <ReplyThread parentEv={parentEv} onWidgetLoad={onWidgetLoad} ref={ref} />;
}
render() {