feat(extra-info): inject extra info in nested replies
Bug: twpowertools:93
Change-Id: Id60030804146981ca3f59a6b2c1d419bbf1f731c
diff --git a/src/contentScripts/communityConsole/extraInfo/services/message.js b/src/contentScripts/communityConsole/extraInfo/services/message.js
index 3b43403..3ad9798 100644
--- a/src/contentScripts/communityConsole/extraInfo/services/message.js
+++ b/src/contentScripts/communityConsole/extraInfo/services/message.js
@@ -4,9 +4,13 @@
export default class MessageExtraInfoService {
static getMessageIdFromNode(messageNode) {
- const id =
- messageNode.querySelector('.scTailwindThreadMessageMessagecardcontent')
- ?.getAttribute?.('data-stats-id');
+ const isMainReply =
+ messageNode.tagName == 'SC-TAILWIND-THREAD-MESSAGE-MESSAGE-CARD';
+ const cardContentClass = isMainReply ?
+ '.scTailwindThreadMessageMessagecardcontent' :
+ '.scTailwindThreadMessageCommentcardnested-reply';
+ const id = messageNode.querySelector(cardContentClass)
+ ?.getAttribute?.('data-stats-id');
if (id === undefined)
throw new Error(`Couldn't retrieve message id from node.`);
return id;