FIX: ensures diversity code is not applied multiple times (#10517)

FIX: ensures diversity code is not applied multiple times (#10517)

diff --git a/app/assets/javascripts/discourse/app/components/emoji-picker.js b/app/assets/javascripts/discourse/app/components/emoji-picker.js
index c2f105e..6d31749 100644
--- a/app/assets/javascripts/discourse/app/components/emoji-picker.js
+++ b/app/assets/javascripts/discourse/app/components/emoji-picker.js
@@ -176,7 +176,10 @@ export default Component.extend({
       return false;
     }
 
-    this.set("hoveredEmoji", event.target.title);
+    this.set(
+      "hoveredEmoji",
+      this._codeWithDiversity(event.target.title, this.selectedDiversity)
+    );
   },
 
   @action
@@ -241,7 +244,9 @@ export default Component.extend({
   },
 
   _codeWithDiversity(code, selectedDiversity) {
-    if (selectedDiversity !== 0 && isSkinTonableEmoji(code)) {
+    if (/:t\d/.test(code)) {
+      return code;
+    } else if (selectedDiversity !== 0 && isSkinTonableEmoji(code)) {
       return `${code}:t${selectedDiversity + 1}`;
     } else {
       return code;

GitHub sha: b6dd3eca

This commit appears in #10517 which was merged by jjaffeux.