Deprecate forceMarkAsRead option

The workaround applied by this option is no longer necessary since the
issue being worked around has already been fixed in the Community
Console.

Bug: twpowertools:14
Change-Id: I20a28937cfb8ce8e186c1ddfed95f294473c4a40
diff --git a/src/common/optionsPrototype.json5 b/src/common/optionsPrototype.json5
index 191d0e1..64d1745 100644
--- a/src/common/optionsPrototype.json5
+++ b/src/common/optionsPrototype.json5
@@ -80,10 +80,6 @@
     defaultValue: false,
     context: 'options',
   },
-  'forcemarkasread': {
-    defaultValue: false,
-    context: 'options',
-  },
 
   // Experiments:
   'threadlistavatars': {
@@ -118,4 +114,8 @@
     defaultValue: false,
     context: 'deprecated',
   },
+  'forcemarkasread': {
+    defaultValue: false,
+    context: 'deprecated',
+  },
 }
diff --git a/src/contentScripts/communityConsole/forceMarkAsRead.js b/src/contentScripts/communityConsole/forceMarkAsRead.js
deleted file mode 100644
index c573788..0000000
--- a/src/contentScripts/communityConsole/forceMarkAsRead.js
+++ /dev/null
@@ -1,81 +0,0 @@
-import {CCApi} from '../../common/api.js';
-import {getAuthUser} from '../../common/communityConsoleUtils.js';
-
-var authuser = getAuthUser();
-
-// Send a request to mark the current thread as read
-export function markCurrentThreadAsRead() {
-  console.debug(
-      '[forceMarkAsRead] %cTrying to mark a thread as read.',
-      'color: #1a73e8;');
-
-  var threadRegex =
-      /\/s\/community\/?.*\/forum\/([0-9]+)\/?.*\/thread\/([0-9]+)/;
-
-  var url = location.href;
-  var matches = url.match(threadRegex);
-  if (matches !== null && matches.length > 2) {
-    var forumId = matches[1];
-    var threadId = matches[2];
-
-    console.debug('[forceMarkAsRead] Thread details:', {forumId, threadId});
-
-    return CCApi(
-               'ViewThread', {
-                 1: forumId,
-                 2: threadId,
-                 // options
-                 3: {
-                   // pagination
-                   1: {
-                     2: 0,  // maxNum
-                   },
-                   3: false,   // withMessages
-                   5: false,   // withUserProfile
-                   6: true,    // withUserReadState
-                   9: false,   // withRequestorProfile
-                   10: false,  // withPromotedMessages
-                   11: false,  // withExpertResponder
-                 },
-               },
-               true, authuser)
-        .then(thread => {
-          if (thread?.[1]?.[6] === true) {
-            console.debug(
-                '[forceMarkAsRead] This thread is already marked as read, but marking it as read anyways.');
-          }
-
-          var lastMessageId = thread?.[1]?.[2]?.[10];
-
-          console.debug('[forceMarkAsRead] lastMessageId is:', lastMessageId);
-
-          if (lastMessageId === undefined)
-            throw new Error(
-                'Couldn\'t find lastMessageId in the ViewThread response.');
-
-          return CCApi(
-              'SetUserReadStateBulk', {
-                1: [{
-                  1: forumId,
-                  2: threadId,
-                  3: lastMessageId,
-                }],
-              },
-              true, authuser);
-        })
-        .then(_ => {
-          console.debug(
-              '[forceMarkAsRead] %cSuccessfully set as read!',
-              'color: #1e8e3e;');
-        })
-        .catch(err => {
-          console.error(
-              '[forceMarkAsRead] Error while marking current thread as read: ',
-              err);
-        });
-  } else {
-    console.error(
-        '[forceMarkAsRead] Couldn\'t retrieve forumId and threadId from the current URL.',
-        url);
-  }
-}
diff --git a/src/contentScripts/communityConsole/main.js b/src/contentScripts/communityConsole/main.js
index 69b3bb7..3924af6 100644
--- a/src/contentScripts/communityConsole/main.js
+++ b/src/contentScripts/communityConsole/main.js
@@ -5,7 +5,6 @@
 import {addBatchLockBtn, nodeIsReadToggleBtn} from './batchLock.js';
 import {injectDarkModeButton, isDarkThemeOn} from './darkMode.js';
 import {applyDragAndDropFix} from './dragAndDropFix.js';
-import {markCurrentThreadAsRead} from './forceMarkAsRead.js';
 import {injectPreviousPostsLinks} from './profileHistoryLink.js';
 import {unifiedProfilesFix} from './unifiedProfiles.js';
 
@@ -39,9 +38,6 @@
 
   // Unified profile iframe
   'iframe',
-
-  // Thread component
-  'ec-thread',
 ];
 
 function handleCandidateNode(node) {
@@ -131,11 +127,6 @@
         unifiedProfilesFix.checkIframe(node)) {
       unifiedProfilesFix.fixIframe(node);
     }
-
-    // Force mark thread as read
-    if (options.forcemarkasread && node.tagName == 'EC-THREAD') {
-      markCurrentThreadAsRead();
-    }
   }
 }
 
diff --git a/src/static/_locales/ca/messages.json b/src/static/_locales/ca/messages.json
index 967853a..aa91d18 100644
--- a/src/static/_locales/ca/messages.json
+++ b/src/static/_locales/ca/messages.json
@@ -107,10 +107,6 @@
     "message": "Desactiva a la força l'experiment <code class=\"help\" title=\"Aquest experiment, quan està actiu, introdueix un rediseny de la interfície dels perfils que també unifica tots els perfils en un únic.\">SMEI_UNIFIED_PROFILES</code> a la Consola de la Comunitat.",
     "description": "Link to learn more about the profile indicator feature"
   },
-  "options_forcemarkasread": {
-    "message": "Cada vegada que obris un fil a la Consola de la Comunitat, envia automàticament una petició per marcar-lo com a llegit. Aquesta és una opció temporal usada com a <i>workaround</i> d'<a href=\"https://support.google.com/s/community/forum/51488989/thread/114559215\" target=\"_blank\" rel=\"noreferrer noopener\">aquest bug</a>.",
-    "description": "Feature checkbox in the options page"
-  },
   "options_profileindicator_header": {
     "message": "Punt indicador",
     "description": "Heading for the profile indicator feature options"
diff --git a/src/static/_locales/en/messages.json b/src/static/_locales/en/messages.json
index 16c0e0f..09881d9 100644
--- a/src/static/_locales/en/messages.json
+++ b/src/static/_locales/en/messages.json
@@ -111,10 +111,6 @@
     "message": "Force disable the <code class=\"help\" title=\"This experiment, when enabled, introduces a redesign of the profile view which also unifies all forum profiles into a single one.\">SMEI_UNIFIED_PROFILES</code> experiment in the Community Console.",
     "description": "Feature checkbox in the options page"
   },
-  "options_forcemarkasread": {
-    "message": "Each time you open a thread in the Community Console, automatically send a request to mark it as read. This is a temporary option used to work around <a href=\"https://support.google.com/s/community/forum/51488989/thread/114559215\" target=\"_blank\" rel=\"noreferrer noopener\">this bug</a>.",
-    "description": "Feature checkbox in the options page"
-  },
   "options_profileindicator_header": {
     "message": "Indicator dot",
     "description": "Heading for the profile indicator feature options"
diff --git a/src/static/_locales/es/messages.json b/src/static/_locales/es/messages.json
index 1f70b4e..4bea06d 100644
--- a/src/static/_locales/es/messages.json
+++ b/src/static/_locales/es/messages.json
@@ -111,10 +111,6 @@
     "message": "Desactiva forzosamente el experimento <code class=\"help\" title=\"Este experimento, cuando está activado, introduce un rediseño de la interfaz de los perfiles que también unifica todos los perfiles en cada foro en uno único.\">SMEI_UNIFIED_PROFILES</code> en la Consola de la Comunidad.",
     "description": "Link to learn more about the profile indicator feature"
   },
-  "options_forcemarkasread": {
-    "message": "Cada vez que abras un hilo en la Consola de la Comunidad, enviar automáticamente una petición para marcarlo como leído. Esta es una opción temporal usada como <i>workaround</i> de <a href=\"https://support.google.com/s/community/forum/51488989/thread/114559215\" target=\"_blank\" rel=\"noreferrer noopener\">este bug</a>.",
-    "description": "Feature checkbox in the options page"
-  },
   "options_profileindicator_moreinfo": {
     "message": "+info sobre las 2 opciones anteriores",
     "description": "Link to learn more about the profile indicator feature"
diff --git a/src/static/options/options.html b/src/static/options/options.html
index 09ce1bb..d6be8d6 100644
--- a/src/static/options/options.html
+++ b/src/static/options/options.html
@@ -45,7 +45,6 @@
         <div class="option"><input type="checkbox" id="enhancedannouncementsdot"> <label for="enhancedannouncementsdot" data-i18n="enhancedannouncementsdot"></label></div>
         <div class="option"><input type="checkbox" id="repositionexpandthread"> <label for="repositionexpandthread" data-i18n="repositionexpandthread"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>
         <div class="option"><input type="checkbox" id="disableunifiedprofiles"> <label for="disableunifiedprofiles" data-i18n="disableunifiedprofiles"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>
-        <div class="option"><input type="checkbox" id="forcemarkasread"> <label for="forcemarkasread" data-i18n="forcemarkasread"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>
         <h4 data-i18n="profileindicator_header"></h4>
         <div class="option"><input type="checkbox" id="profileindicator"> <label for="profileindicator" data-i18n="profileindicator"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>
         <div class="option"><input type="checkbox" id="profileindicatoralt"> <label for="profileindicatoralt" data-i18n="profileindicatoralt"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>