Retort - a reaction-style plugin for Discourse


(James Kiesel) #1

Hey folks,

I had a hack weekend and came up with a pretty cool plugin; it allows you to add slack-style reactions to posts via the normal emoji picker menu.

Feel free to pull it down and have a play (http://www.github.com/gdpelican/retort), keeping in mind that it was thrown together quickly and may still have a rough edge or two (let me know what sucks!).

Enjoy!


Symbol for like - why is it a :heart:?
"Nodding your head" in online communication
Reaction Emoticons
"I read it" button alongside "I like it" button?
People are not using the :heart: button
NEW LIKE and LIKE COUNT?
Discourse Classic Theme
Struggling to remove automated post quality control
"Nodding your head" in online communication
Babble - A Chat Plugin
What is the most awesome plugin for Discourse, that does not yet exist?
"Nodding your head" in online communication
:clap: Claps Vs Likes :heart:
Discourse Vincent theme
Custom JS in head makes messages not work
Is it possible to add other like buttons?
How can I add "dislike" button?
Retort + Post Like Counter
Love, Hate, Sad, Laughter
Like, dislike or ambivalent
How can I add "dislike" button?
How can I add "dislike" button?
Negative feedback or "disapprove" feature?
#2

This looks awesome!

Though, would it be possible to limit the usable retorts (so only whitelisted, approved can be used), similar to how Xenforo does it?


(James Kiesel) #3

Seems like a possibility, sure.


(Erlend Sogge Heggen) #4

One thing I couldn’t tell just by looking at your demo: Is there a way to see who gave which reaction? If you hover over a posted reaction on Slack, you’ll see that "bob and alice reacted with :gasp:

Is there an equivalent to that here?


(James Kiesel) #5

Yes, it supports that:

Although the thing that it doesn’t do yet is group the reactions by type (so 3 people reacting with heart face will render out three separate heart face reactions); I’ll likely do this at some point soon though.


(James Kiesel) #6

FYI I’ve updated this to work with the new compatibility layer changes outlined here:


(Ivan) #7

Hey James.

Just wondering if you’ve made any progress on getting the reactions to tally up according to the type of reaction?


(James Kiesel) #8

Well, the quick answer is, I haven’t done anything.

The slightly longer answer is that if I get bugged enough by a few people interested in putting this on their instance, and feeling the need for this functionality, I’d be happy to spend a little more time on it.


(Unknwon) #9

Hi, I’ve added line git clone https://github.com/gdpelican/retort.git to my container/app.yml, and added retort to Basic Setup -> post menu, also enabled Plugins -> retort enabled.

But when I visit the topic/post, the smile icon does not appear anyway.

Running latest Discourse v1.5.0.beta11 +187.

Any suggestions? Thanks!


(cpradio) #10

Chances are you are on a version that needs the new plugin API and this hasn’t been updated to utilize it yet.


(Unknwon) #11

Ah… OK, thank you though!


(cpradio) #12

I’ve got the initializer working, but I’m struggling to figure out how to deal with the new post after cooked connector. Primarily because I don’t have a lot of experience with the new API yet, so I’m still trying to learn it by examples.


(James Kiesel) #13

Super appreciate the help @cpradio. Discourse pulling the rug out from the plugin APIs has come at a bit of an inconvenient time, heh, but will definitely commit to getting everything back up and running as soon as I’m able.


(cpradio) #14

No problem. I have commited the initializer changes here

@eviltrout, do you mind giving me a helping hand so I can learn this a bit better, I know I need to use decorateWidget, I think, for the post-contents:after-cooked, but it complains that retorts is not defined. Which makes me feel I either need to include it, or change how it is being accessed. (also, talk to me like I’m a 2 year old, as JavaScript frameworks are still not my fortray and my experience with it is still only via Discourse).

@gdpelican, if you have any ideas too, more than willing to take advice as I keep pushing on figuring out how to get this operational again.


(cpradio) #15

Sweet, I’m making progress, I now have accecss to the retorts in the decorateWidget post-contents:after-cooked call. This shouldn’t take too much longer (I don’t think).

I’m placing the retorts in the PostSerializer, this can probably be refactored/refined to be better, but it works.


(cpradio) #16

And done!

@gdpelican, I haven’t updated the version in the plugin.rb, not sure how you want to do that, but I’ll submit a PR here shortly.

PR Submitted

I didn’t update the version in the PR, so feel free to update it accordingly.


(cpradio) #17

So there is one bug, I can’t get it to refresh the post when a retort is added… I even tried manually calling appEvents.trigger('post-stream:refresh', { id: post.id});, but that didn’t do it either… :confused:

So right now it requries you to reload the topic or the post to see the retorts that were added.


(cpradio) #18

So through trial and error this rerenders the retort for the current user, but it doesn’t force a rerender for viewing users.

Edit: More Corrections

  • Anonymous do not see the retort button anymore
  • Anonymous can see the retorts
  • Fixed all outstanding issues on GitHub (including the hard coding of the Emoji URL)

(cpradio) #19

I also started grouping the retorts, but I don’t really like this approach, it should be done at a model/database level and sent down already goruped, otherwise, it becomes very costly.


(James Kiesel) #20

Whoa, this is great! Thanks for the spike, @cpradio! It’ll help me out a bunch to have a reference for when I make the adjustment for Babble as well.

For the grouping, I’ve actually re-implemented this for Loomio (here) in a way that caters better to that use case; instead of hashes which look like this

{
  bob: "smiley",
  alice: "smiley"
}

We really want hashes which look like this:

{
  smiley: ["bob", "alice"] 
}

Which makes the clientside rendering pretty trivial. It may be backwards incompatible, but I think we’ll have to do it that way to get the grouping functionality working in a way that isn’t horrible.