From 11ae0805b07874bb08f6411e304694d92769afe5 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Tue, 1 May 2018 17:42:58 +0100
Subject: [PATCH] re-order ReplyThread methods for readability

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
 src/components/views/elements/ReplyThread.js | 74 ++++++++++----------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/components/views/elements/ReplyThread.js b/src/components/views/elements/ReplyThread.js
index 40db914941..138431259f 100644
--- a/src/components/views/elements/ReplyThread.js
+++ b/src/components/views/elements/ReplyThread.js
@@ -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;
     }