fix(extra-info): handle successive message loads and promoted messages

When loading a thread, some messages might be collapsed and are loaded
in subsequent requests. This CL handles this case by holding an array of
messages which grows each time the user expands a gap of messages.

Furthermore, this CL also considers promoted messages for the message
list (before this, the extra info chips were added to promoted messages
only if they were loaded outside of the promoted messages structure as
well).

Bug: twpowertools:93
Change-Id: I8b6f4e8f4a97c7f5e4cdde52b6b773b9631fbe57
diff --git a/src/contentScripts/communityConsole/extraInfo/services/message.js b/src/contentScripts/communityConsole/extraInfo/services/message.js
index 3ad9798..268fea5 100644
--- a/src/contentScripts/communityConsole/extraInfo/services/message.js
+++ b/src/contentScripts/communityConsole/extraInfo/services/message.js
@@ -1,5 +1,3 @@
-import MessageModel from '../../../../models/Message.js';
-
 import StatesExtraInfoService from './states.js';
 
 export default class MessageExtraInfoService {
@@ -16,22 +14,11 @@
     return id;
   }
 
-  static getMessageFromThreadModel(messageId, threadModel) {
-    for (const messageOrGap of threadModel.getMessageOrGapModels()) {
-      if (!(messageOrGap instanceof MessageModel)) continue;
-      if (messageOrGap.getId() == messageId) {
-        return messageOrGap;
-      } else {
-        for (const subMessageOrGap of messageOrGap.getCommentsAndGaps()) {
-          if (!(subMessageOrGap instanceof MessageModel)) continue;
-          if (subMessageOrGap.getId() == messageId) {
-            return subMessageOrGap;
-          }
-        }
-      }
+  static getMessageFromList(messageId, messagesList) {
+    for (const message of messagesList) {
+      if (message.getId() == messageId) return message;
     }
-
-    throw new Error(`Couldn't find message ${messageId} in thread.`);
+    throw new Error(`Couldn't find message ${messageId} in the message list.`);
   }
 
   static getMessageChips(messageModel) {