feat(extra-info): add more ItemMetadata states

This CL also adds logic to show the state codename if the localized
friendly name is not available. This is needed because we don't know
what the AUTOMATED_ABUSE_MANUAL_REVIEW state corresponds to, so we can't
have a friendly name and would like to display the codename instead.

Change-Id: I0b9676b4403c6f531ec270aab22ecd512101bcea
diff --git a/src/contentScripts/communityConsole/extraInfo/consts.js b/src/contentScripts/communityConsole/extraInfo/consts.js
index d2f2122..236cf2e 100644
--- a/src/contentScripts/communityConsole/extraInfo/consts.js
+++ b/src/contentScripts/communityConsole/extraInfo/consts.js
@@ -154,6 +154,8 @@
   3: 'automated_abuse_take_down_hide2',
   4: 'automated_abuse_take_down_delete2',
   13: 'automated_abuse_reinstate2',
+  // TODO: Add the following line and its corresponding translation once we know
+  // what the state means: `21: 'automated_abuse_manual_review',`
   10: 'automated_off_topic_hide2',
   14: 'automated_flagged_pending_manual_review2',
   5: 'user_flagged_pending_manual_review',
@@ -167,6 +169,8 @@
   12: 'confirm_off_topic2',
   15: 'googler_off_topic_hide2',
   16: 'expert_flagged_pending_manual_review',
+  19: 'awaiting_classification',
+  20: 'generated_answer_adopted',
 };
 export const kItemMetadataState = {
   0: 'UNDEFINED',
@@ -175,6 +179,7 @@
   3: 'AUTOMATED_ABUSE_TAKE_DOWN_HIDE',
   4: 'AUTOMATED_ABUSE_TAKE_DOWN_DELETE',
   13: 'AUTOMATED_ABUSE_REINSTATE',
+  21: 'AUTOMATED_ABUSE_MANUAL_REVIEW',
   10: 'AUTOMATED_OFF_TOPIC_HIDE',
   14: 'AUTOMATED_FLAGGED_PENDING_MANUAL_REVIEW',
   5: 'USER_FLAGGED_PENDING_MANUAL_REVIEW',
@@ -188,5 +193,6 @@
   12: 'CONFIRM_OFF_TOPIC',
   15: 'GOOGLER_OFF_TOPIC_HIDE',
   16: 'EXPERT_FLAGGED_PENDING_MANUAL_REVIEW',
+  19: 'AWAITING_CLASSIFICATION',
+  20: 'GENERATED_ANSWER_ADOPTED',
 };
-
diff --git a/src/contentScripts/communityConsole/extraInfo/injections/threadList.js b/src/contentScripts/communityConsole/extraInfo/injections/threadList.js
index c4e807c..6a78ea3 100644
--- a/src/contentScripts/communityConsole/extraInfo/injections/threadList.js
+++ b/src/contentScripts/communityConsole/extraInfo/injections/threadList.js
@@ -49,9 +49,15 @@
     const [badge, badgeTooltip] = createExtBadge();
 
     let span = document.createElement('span');
-    const stateI18nKey =
-        'inject_extrainfo_message_state_' + kItemMetadataStateI18n[state];
-    span.textContent = chrome.i18n.getMessage(stateI18nKey) ?? state;
+    let stateLocalized;
+    if (kItemMetadataStateI18n[state]) {
+      const stateI18nKey =
+          'inject_extrainfo_message_state_' + kItemMetadataStateI18n[state];
+      stateLocalized = chrome.i18n.getMessage(stateI18nKey) ?? state;
+    } else {
+      stateLocalized = kItemMetadataState[state] ?? state;
+    }
+    span.textContent = stateLocalized;
     span.title = kItemMetadataState[state] ?? state;
 
     label.append(badge, span);
diff --git a/src/contentScripts/communityConsole/extraInfo/services/states.js b/src/contentScripts/communityConsole/extraInfo/services/states.js
index 6904e3e..17dc34e 100644
--- a/src/contentScripts/communityConsole/extraInfo/services/states.js
+++ b/src/contentScripts/communityConsole/extraInfo/services/states.js
@@ -79,9 +79,14 @@
     const state = itemMetadata?.['1'];
     if (!state || state == 1) return null;
 
-    const stateI18nKey =
-        'inject_extrainfo_message_state_' + kItemMetadataStateI18n[state];
-    const stateLocalized = chrome.i18n.getMessage(stateI18nKey) ?? state;
+    let stateLocalized;
+    if (kItemMetadataStateI18n[state]) {
+      const stateI18nKey =
+          'inject_extrainfo_message_state_' + kItemMetadataStateI18n[state];
+      stateLocalized = chrome.i18n.getMessage(stateI18nKey) ?? state;
+    } else {
+      stateLocalized = kItemMetadataState[state] ?? state;
+    }
 
     const span = document.createElement('span');
     span.textContent = chrome.i18n.getMessage(
diff --git a/src/models/enums/ItemMetadataState.js b/src/models/enums/ItemMetadataState.js
index 3331c08..6567d36 100644
--- a/src/models/enums/ItemMetadataState.js
+++ b/src/models/enums/ItemMetadataState.js
@@ -5,6 +5,7 @@
   AUTOMATED_ABUSE_TAKE_DOWN_HIDE: 3,
   AUTOMATED_ABUSE_TAKE_DOWN_DELETE: 4,
   AUTOMATED_ABUSE_REINSTATE: 13,
+  AUTOMATED_ABUSE_MANUAL_REVIEW: 21,
   AUTOMATED_OFF_TOPIC_HIDE: 10,
   AUTOMATED_FLAGGED_PENDING_MANUAL_REVIEW: 14,
   USER_FLAGGED_PENDING_MANUAL_REVIEW: 5,
@@ -19,6 +20,7 @@
   GOOGLER_OFF_TOPIC_HIDE: 15,
   EXPERT_FLAGGED_PENDING_MANUAL_REVIEW: 16,
   AWAITING_CLASSIFICATION: 19,
+  GENERATED_ANSWER_ADOPTED: 20,
 };
 
 export default kItemMetadataStateEnum;
diff --git a/src/static/_locales/en/messages.json b/src/static/_locales/en/messages.json
index ee327ca..27f893a 100644
--- a/src/static/_locales/en/messages.json
+++ b/src/static/_locales/en/messages.json
@@ -529,6 +529,14 @@
     "message": "Expert flagged (pending manual review)",
     "description": "Thread/message state EXPERT_FLAGGED_PENDING_MANUAL_REVIEW (a PE flagged the message and needs manual review)."
   },
+  "inject_extrainfo_message_state_awaiting_classification": {
+    "message": "Awaiting classification",
+    "description": "Thread/message state AWAITING_CLASSIFICATION."
+  },
+  "inject_extrainfo_message_state_generated_answer_adopted": {
+    "message": "Generated answer adopted",
+    "description": "Thread/message state GENERATED_ANSWER_ADOPTED."
+  },
   "inject_extrainfo_message_state_manual_take_down_hide2": {
     "message": "Hidden manually",
     "description": "Thread/message state MANUAL_TAKE_DOWN_HIDE (the message has been manually hidden by a Googler)."