FIX: selected diversity was off by one (#10659)

FIX: selected diversity was off by one (#10659)

diff --git a/app/assets/javascripts/discourse/app/components/emoji-picker.js b/app/assets/javascripts/discourse/app/components/emoji-picker.js
index 1fa3ca0..edeccd3 100644
--- a/app/assets/javascripts/discourse/app/components/emoji-picker.js
+++ b/app/assets/javascripts/discourse/app/components/emoji-picker.js
@@ -150,7 +150,7 @@ export default Component.extend({
     ].map((name, index) => {
       return {
         name,
-        icon: index === this.selectedDiversity ? "check" : "",
+        icon: index + 1 === this.selectedDiversity ? "check" : "",
       };
     });
   }),
@@ -162,7 +162,8 @@ export default Component.extend({
   },
 
   @action
-  onDiversitySelection(scale) {
+  onDiversitySelection(index) {
+    const scale = index + 1;
     this.emojiStore.diversity = scale;
     this.set("selectedDiversity", scale);
 
@@ -248,8 +249,8 @@ export default Component.extend({
   _codeWithDiversity(code, selectedDiversity) {
     if (/:t\d/.test(code)) {
       return code;
-    } else if (selectedDiversity !== 0 && isSkinTonableEmoji(code)) {
-      return `${code}:t${selectedDiversity + 1}`;
+    } else if (selectedDiversity > 1 && isSkinTonableEmoji(code)) {
+      return `${code}:t${selectedDiversity}`;
     } else {
       return code;
     }

GitHub sha: e8053d17

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