feat(cc-slowness-fix): remove unused large data from some requests
The ViewForum and ViewThread requests may contain the
User.ProfileAbuse.account_reported_abuse field in their responses which
for some users contains megabytes of data and is seemingly unused by the
Community Console.
Thus, this CL removes this data from the responses when the feature
which fixes the CC slowness and high memory usage is enabled.
Change-Id: Idef49285c29d256c5413971c80581ba4ad65cb98
diff --git a/src/xhrInterceptor/responseModifiers/removeUserAbuseEventsInViewThread.js b/src/xhrInterceptor/responseModifiers/removeUserAbuseEventsInViewThread.js
new file mode 100644
index 0000000..ccaeb95
--- /dev/null
+++ b/src/xhrInterceptor/responseModifiers/removeUserAbuseEventsInViewThread.js
@@ -0,0 +1,16 @@
+const removeUserAbuseEventsInViewThread = {
+ urlRegex: /api\/ViewThread/i,
+ featureGated: true,
+ features: ['fixpekb269560789'],
+ isEnabled(options) {
+ return options['fixpekb269560789'];
+ },
+ async interceptor(_, response) {
+ if (response?.[1]?.[13]?.[8]?.[7]) {
+ delete response[1][13][8][7];
+ }
+ return response;
+ },
+};
+
+export default removeUserAbuseEventsInViewThread;