Flatten thread: fix behavior after replying

After replying to a thread, the new reply wasn't visible. This was due
to the fact that when the Community Console loaded the thread again, it
used the XHR property `responseText` to read the response instead of
`response`, but until now only `response` returned the modified response
instead of the original one.

Thus, this CL adds logic to also return the modified response (in text
form) when calling `responseText`.

Bug: twpowertools:156
Change-Id: If30112ca2827749a5d6677bfb9dfc790dabd9281
diff --git a/src/xhrInterceptor/utils.js b/src/xhrInterceptor/utils.js
index 849c543..d48dfd5 100644
--- a/src/xhrInterceptor/utils.js
+++ b/src/xhrInterceptor/utils.js
@@ -78,7 +78,7 @@
       return JSON.stringify(json);
 
     case 'arraybuffer':
-      const encoder = new TextEncoder();
+      var encoder = new TextEncoder();
       return encoder.encode(JSON.stringify(json)).buffer;
 
     default:
@@ -89,6 +89,13 @@
   }
 }
 
+export function convertJSONToResponseText(xhr, json) {
+  return convertJSONToResponse({
+    $isArrayProto: xhr.$isArrayProto,
+    responseType: 'text',
+  }, json);
+}
+
 export function triggerEvent(eventName, body, id) {
   var evt = new CustomEvent('TWPT_' + eventName, {
     detail: {