gdpelican / retort

A reactions plugin for Discourse
MIT License
57 stars 39 forks source link

A way to see who reacted #42

Open daath opened 5 years ago

daath commented 5 years ago

My users have requested a way to see who has reacted - Doing mouse-over reveals a couple of names, but not the rest - Clicking it just reacts - Holding LMB on the icon reveals the same couple of names...

Thanks! :)

IwishIcanFLighT commented 5 years ago

Hi!

I would also be very interested for the same reasons as @daath stated. :+1:

EDIT: Looking at the code, it seems like the modification should be done in the sentence() function Line 23:

https://github.com/gdpelican/retort/blob/798535fd3ffb179833d9c23a5d82793b2bf9e645/assets/javascripts/discourse/widgets/templates/retort-toggle.js.es6

  sentence() {
    let usernames = this.state.usernames
    switch(usernames.length) {
      case 1:  return `${usernames[0]} reacted with :${this.state.emoji}:`
      case 2:  return `${usernames[0]} and ${usernames[1]} reacted with :${this.state.emoji}:`
      default: return `${usernames[0]}, ${usernames[1]}, and ${usernames.length - 2} others reacted with :${this.state.emoji}:`
    }
}

Replacing default case by a loop inside usernames should be fairly simple to do

wolftune commented 4 years ago

Would be clearer if title were edited to say "all who reacted"

GokulNC commented 4 years ago

@IwishIcanFLighT Can you please make a pull request with the changes you said?

IwishIcanFLighT commented 4 years ago

@GokulNC Sorry I never got the time to actually make this change and no longer need it for my discourse instance.

In the meantime from what I found it looks like my previous suggestion cannot be applied anymore as the plugin seems to support different locales now: https://github.com/gdpelican/retort/blob/7fd191b7e47a9612163436556e14ed1cd1b313ac/config/locales/client.en.yml

en:
  js:
    retort:
      title: 'add an emoji reaction to this post'
      reactions:
        one_person:  "%{first} reacted with :%{emoji}:"
        two_people:  "%{first} and %{second} reacted with :%{emoji}:"
        many_people: "%{first}, %{second}, and %{count} others reacted with :%{emoji}:"

I suppose you'd also need to modify the code in this file as well: https://github.com/gdpelican/retort/blob/8d582c512ae89427c6e0520f9f256e91c05aa07b/assets/javascripts/discourse/widgets/retort-toggle.js.es6

  sentence({ usernames, emoji }) {
    let key
    switch(usernames.length) {
      case 1: key = 'retort.reactions.one_person'; break
      case 2: key = 'retort.reactions.two_people'; break
      default: key = 'retort.reactions.many_people'; break
    }
crsh commented 2 years ago

Hi there, thanks for this wonderful plugin! My community has also expressed an interest in this feature. To me it would be ideal if this worked similarly to the built-in like button: Always display a number alongside the reaction and show the reacters underneath the reactions when the number is clicked. I think the relevant Discourse code can be found here.