message: re-order ReplyThread methods for readability
diff: @@ -59,43 +59,6 @@ export default class ReplyThread extends React.Component {
  this.collapse = this.collapse.bind(this);
  }
  - async initialize() {
  - const {parentEv} = this.props;
  - // at time of making this component we checked that props.parentEv has a parentEventId
  - const ev = await ReplyThread.getEvent(this.room, ReplyThread.getParentEventId(parentEv));
  - if (this.unmounted) return;
  -
  - if (ev) {
  - this.setState({
  - events: [ev],
  - }, this.loadNextEvent);
  - } else {
  - this.setState({err: true});
  - }
  - }
  -
  - async loadNextEvent() {
  - if (this.unmounted) return;
  - const ev = this.state.events[0];
  - const inReplyToEventId = ReplyThread.getParentEventId(ev);
  -
  - if (!inReplyToEventId) {
  - this.setState({
  - loading: false,
  - });
  - return;
  - }
  -
  - const loadedEv = await ReplyThread.getEvent(this.room, inReplyToEventId);
  - if (this.unmounted) return;
  -
  - if (loadedEv) {
  - this.setState({loadedEv});
  - } else {
  - this.setState({err: true});
  - }
  - }
  -
  static async getEvent(room, eventId) {
  const event = room.findEventById(eventId);
  if (event) return event;
  @@ -233,6 +196,43 @@ export default class ReplyThread extends React.Component {
  this.unmounted = true;
  }
  + async initialize() {
  + const {parentEv} = this.props;
  + // at time of making this component we checked that props.parentEv has a parentEventId
  + const ev = await ReplyThread.getEvent(this.room, ReplyThread.getParentEventId(parentEv));
  + if (this.unmounted) return;
  +
  + if (ev) {
  + this.setState({
  + events: [ev],
  + }, this.loadNextEvent);
  + } else {
  + this.setState({err: true});
  + }
  + }
  +
  + async loadNextEvent() {
  + if (this.unmounted) return;
  + const ev = this.state.events[0];
  + const inReplyToEventId = ReplyThread.getParentEventId(ev);
  +
  + if (!inReplyToEventId) {
  + this.setState({
  + loading: false,
  + });
  + return;
  + }
  +
  + const loadedEv = await ReplyThread.getEvent(this.room, inReplyToEventId);
  + if (this.unmounted) return;
  +
  + if (loadedEv) {
  + this.setState({loadedEv});
  + } else {
  + this.setState({err: true});
  + }
  + }
  +
  canCollapse() {
  return this.state.events.length > 1;
  }
  