Flatten threads: don't show reply button when appropriate

This CL also refactors the response interceptors to use the new
ThreadModel.

Fixed: twpowertools:160
Change-Id: I859e0fa1b8f5f4057bd66af3d167e4b21c6d12ed
diff --git a/src/xhrInterceptor/responseModifiers/loadMoreThread.js b/src/xhrInterceptor/responseModifiers/loadMoreThread.js
index f259fe4..2ddf37d 100644
--- a/src/xhrInterceptor/responseModifiers/loadMoreThread.js
+++ b/src/xhrInterceptor/responseModifiers/loadMoreThread.js
@@ -17,17 +17,20 @@
   async interceptor(request, response) {
     if (!response[1]?.[40]) return response;
 
-    const forumId = response[1]?.[2]?.[1]?.[3];
-    const threadId = response[1]?.[2]?.[1]?.[1];
-    if (!forumId || !threadId) {
+    const thread = new ThreadModel(response[1]);
+
+    if (!thread.getForumId() || !thread.getId()) {
       console.error(
           '[loadMoreThread] Couldn\'t find forum id and thread id for:',
           request.$TWPTRequestURL);
       return response;
     }
 
-    const mogs = MessageModel.mapToMessageOrGapModels(response[1]?.[40] ?? []);
-    response[1][40] = await this.loadGaps(forumId, threadId, mogs, 0);
+    const mogs = thread.getMessageOrGapModels();
+    thread.setRawCommentsAndGaps(
+        await this.loadGaps(thread.getForumId(), thread.getId(), mogs, 0));
+
+    response[1] = thread.toRawThread();
     return response;
   },
   loadGaps(forumId, threadId, mogs, it) {
@@ -94,7 +97,8 @@
                },
                /* authenticated = */ true, authuser)
         .then(res => {
-          return MessageModel.mapToMessageOrGapModels(res[1]?.[40] ?? []);
+          const thread = new ThreadModel(res[1]);
+          return thread.getMessageOrGapModels();
         });
   }
 };