DEV: Added support for custom site setting 'emoji_list' (PR #12414)

@jjaffeux

GitHub

I feel like emoji list should be in core itself though ( I mean the component itself). Let me discuss this internally.

That will be a nice thing to have😍

For this to work we will need the setting to accept some parameter “required” emojis, otherwise no one but discourse-reactions can use it

Can you explain which types of parameters?

What I mean is that we need to have the heart always present in the list, but what if another plugin doesn’t need any specific emoji in its setting ?

For this i think we can remove appending likes in the list and add a separate setting in reactions plugin and make this setting simple just for emojis list

@jjaffeux I added the setting in this PR and tried to make it general use do try it out locally

use em here please

did you lose my comment about sharing a shift fn here ?

      value,

can we replace all of this by:

if (!emojiUrlFor(input)) {
  //
}
  • checking input doesn’t seem necessary, emojiUrlFor will call buildEmojiUrl which does a String(input) so even if null or undefined will return “”
  • we don’t care what input includes, we just need to know if it’s a valid emoji or not

I don’t see the need for this line, just use this.collection directly

what if values is empty? can it be empty ?

why the empty lines here ? it’s all about object setup, you can group it

can we find a better name than object please ?

can we find a better name than res please ?

values are the site-setting value, if it is empty then collection will be empty. and if the collection is empty then there’s no editing of the textbox

I read the comment, but the reason for not doing this was, we can make it a single function but we are doing totally different operations in both of these functions. combining both will reduce the readability of the function IMO. thoughts?

shiftDirection(index, direction) {
    if (direction === "up" && !index) {
      return;
    }

    if (direction === "down" && index === this.collection.length) {
      return;
    }

    const temp = this.collection[index];

    if(direction === "up") {
      this.collection[index] = this.collection[index - 1];
      this.collection[index - 1] = temp;
    } else {
      this.collection[index] = this.collection[index + 1];
      this.collection[index + 1] = temp;
    }

    this._saveValues();
  }

Indeed, ill change this