Retort - a reaction-style plugin for Discourse

I’m wondering if this might be caused by a conflict with my own customizations, but is anybody else seeing the following in console after replying?

Uncaught TypeError: Cannot read property 'length' of undefined

Which points to:

api.decorateWidget('post-contents:after-cooked', function (dec) {
        var post = dec.getModel();
        Discourse.Retort = Discourse.Retort || { widgets: {} };
        Discourse.Retort.widgets[post.id] = dec.widget;

      if (post.retorts.length === 0) {
          return;
        }

And then it appears that it doesn’t properly close the submit-panel

This is on v1.5.0.beta11 +277. If nobody else is seeing it, it must be a conflict with my own plugins.

1 Like

You know there’s a really easy way to test that, right? :wink:

1 Like

Just installed - this plugin is working great! :clap: :raised_hands: :thumbsup:

Thank you @gdpelican and @cpradio for all your hard work! :slight_smile:

3 Likes

Thanks for the report, I’ve fixed this in the latest. :palm_tree:!

5 Likes

Hoping there will soon be a way to remove reactions. I added a couple of issues about this.

After a fun little muck about with the new plugin api features, I’ve updated this to use the virtual dom, and allowed for adding / removing reactions via click.

17 Likes

Great! I love it. You’re making very good stuff man

4 Likes

@gdpelican I noticed in your plugin you have:

import PostMenuComponent from 'discourse/components/post-menu';

However, I believe post menu has moved from a component to a widget. With that said though, it still seems to work, why?

EDIT: I see you are using that for priorToApi…and then for current version creating a retort widget?

Yep, there’s different versions for Discourses running before / after the plugin API was introduced. Although if I have another spike on this I may just take it out, as backwards compat isn’t a huge concern to me for this plugin, it leads to massive duplication, and testing on old Discourse versions wouldn’t be my idea of a good time.

4 Likes

Hey @gdpelican,

I’ve noticed a bug, specifically, when attempting to add an emoticon whilst in mobile view, the retort-emoji is not added to the page dynamically like it is in desktop view. Additionally, there is an error message:

Would you know what could be causing this? Or has anyone else encountered this? Going to dig around but thought I’d also post here first in case someone has also experienced this.

2 Likes

Pretty nice plugin. With Facebook really pushing people to use emoji to react in different ways it’s become a popular request on forums that don’t have it. I know on some of my xenforo based ones we have something similar, glad to see a plugin here for it too.

Was there a way to limit the reactions to a few selected options rather than any emoji? Similar to how Facebook has a small selection of general ones?

It’s been requested a couple times, and is definitely top of the list for this plugin, although my hacking time is pretty limited these days, and will be mostly focused on Babble when it arises. At some point I’ll dig up a rainy afternoon to make it happen though. (PRs also welcome!)

2 Likes

I created a plugin that limits the number of emojis to four to to emulate Facebook’s limited (six) reactions.
For example, in my emoji library, I have,

const groups = [
  {
    name:"people",
    fullname:"People",
    tabicon:"grinning",
    icons:[
     "laughing",
     "astonished",
     "cry",
     "rage"
    ]
  }
];

// scrub groups
groups.forEach(group => {
  group.icons = group.icons.reject(obj => !Discourse.Emoji.exists(obj));
});

// export so others can modify
Discourse.Emoji.groups = groups;

export default groups;

…which with some CSS looks like,

…and doesn’t affect the composer emojis,

Let me know if you’d like to tinker with it, and I’ll put it up on my Github.

9 Likes

I would, let me know when you upload it and I’ll mess around with it on a development board.

Here it is, https://github.com/ivanrlio/retort .

Hope this is what you were looking for.

4 Likes

Wouldn’t the best thing be to make a pull request for this feature to be added as an optional setting in the canonical Retort plugin?

7 Likes

Some things to be aware of when submitting that PR:

  • We’ll need to be able to control whether Retort uses a custom emoji set or not, probably via a site setting. I want to make sure folks can have the slack emoji experience if they want the slack emoji experience, or the facebook emoji experience if they want that.
  • Perhaps more importantly, we need to allow folks to specify which emojis they’re getting when they select the custom emoji option, rather than hard-coding them.
  • As an added bonus, supporting custom (user uploaded) emojis would be super cool here, as it would allow for super great control and flexibility over what people can react with.
7 Likes

Has anyone else figured out have retort behave the same way on mobile as it does on desktop? Right now when you react with an emoji, it only appears after refresh, which make it appear as though the button does nothing.

3 Likes

i haven’t read the threads and sorry if this is a duplicate, but any way to limit the emoji’s to few common ones for everyone?

btw, thanks for the plugin. lots of times you want to react to a post, but you don’t want to give a heart. and this is really helpful.

Hey @Pad_Pors. If you check my github repo, specifically, https://github.com/ivanrlio/retort/blob/master/assets/javascripts/discourse/lib/emoji/emoji-groups.js.es6, you can see that I only have 4 emojis listed. Since then, I’ve only added one more which is a thumbs-up to emulate the ‘Like’ on Facebook.

3 Likes