Retort - a reaction-style plugin for Discourse

This plugin is #end-of-life. Please use the Reactions Plugin.


Discourse Reactions is a poor substitute for one key reason: it limits reactions to one per post. That’s a dramatic reduction in the utility of reactions compared to Retort which allows people to give multiple reactions to the same post.

I really wish Retort would be maintained for this reason. The better solution would be for Discourse Reactions to be updated to allow multiple reactions.


The other big deficit is that retort allows you to select from all available emojis while you have to define a set of emojis for discourse reactions. If discourse reactions had both of these features I would gladly drop retort, but until it does my users will not be happy if I tell them they’re losing access to 95% of emoji reactions.


There is a #feature topic which shows some promise…


Yes, if this is all implemented I think I could easily convince my user base to migrate. It just kinda sucks to retire the alternative before this is fully available.


I opened a new request Support multiple-reactions per post (Retort style) about multiple-reactions-per-post, since the other link is only for offering more reaction choices for the one-and-only reaction that Discourse Reactions allows.


The Retort plugin isn’t an #official one so we don’t have any say in when it stops being actively developed and maintained by the community. :man_shrugging: The best we can do is try and keep people informed where possible so they have some time to find an alternative (or at least give their members a heads-up to try and soften the disappointment).

Hopefully those two #feature requests will be adopted into the #reactions plugin at some point, but as yet they’re still in the ‘nice ideas’ stage. But I’ve got my fingers crossed. :crossed_fingers:


I understand where you’re coming from. The reality is that neither I or James have had the time to properly support Retort for some time. You’ll notice that the last commit on the repository is over a year ago (by me on 21 July 2021). It’s great that the plugin has continued to work this long and it is a testament to the quality of the work James put into building it.

When I say I don’t have the time, believe me, I wish I did! I feel sad every time I have to make one of these decisions (like with the Landing Pages Plugin). I didn’t build Retort, but I have invested time in it. When you decide to retire something, it’s like accepting that something you’ve created or loved, and spent many hours, days and weeks of your life with, must die. I know it was a tough decision for James to make when he felt he had to move on to other things.

By contrast, the Reactions Plugin is being maintained by, an organisation of over 60 people, on an active basis. It’s in use on a number of the servers used by’s clients. Yes, it doesn’t have the same features as Retort yet, but I would urge you to pursue that feature development as an avenue. Perhaps you could convince someone like me, or another member of Pavilion, to PR a missing feature into the plugin. That would be a smart avenue to achieve your long term goals here.


There is always #marketplace if you want to pay a developer to bring it back to life in the meantime. But you may end up having to do this multiple times or agree a maintenance retainer.


I guess the answer is No? I would like to migrate to reactions and try to find the popular ones…

1 Like

I imagine it would be possible as they’ll be stored in the database somewhere. Unfortunately I don’t have this plugin installed on my test site to check the specifics. Is there a discourse-retort-retorts table or similar?


Here’s how to get a |-separated string for the retorts you currently have in use:

# ./launcher enter app
# rails c
retorts = {}
PostDetail.where(extra: 'retort').each do |p|
  retort = p.key.split('|').first
  (retorts[retort] ||= []) << p

That gives you:

  • First the number of unique retort emoji used
  • Then the retorts in a form you could paste into Reaction configuration, perhaps after trimming if it’s too long to work for the Reactions UI.

For me, I get this string:


If you’d like to copy a list of existing retorts into a post in discourse to discuss what to keep when migrating to Reactions, you might instead use this:

":" + retorts.keys.join(': :') + ':'

For me, that’s currently this set:

:tada: :rage: :money_with_wings: :face_vomiting: :crossed_fingers: :grin: :vulcan_salute: :worried: :slightly_smiling_face: :dart: :+1: :relaxed: :star_struck: :upside_down_face: :sweat_drops: :astonished: :frowning_face: :champagne: :heavy_plus_sign: :bulb: :joy: :fireworks: :zap: :smile: :fast_forward: :grinning: :clap: :sandwich: :heart_eyes: :rofl: :smiley: :wave: :ice_cream: :sob: :mortar_board: :open_mouth: :pray: :grimacing: :roll_eyes: :arrow_right_hook: :brain: :wink: :cry: :nerd_face: :slight_smile: :confused: :ok: :thinking: :it: :heart: :smirk: :sleepy: :eyes: :disappointed: :question: :laughing: :man_shrugging: :drum: :shushing_face: :herb: :man_facepalming: :ear: :scream: :ok_hand: :mantelpiece_clock: :smiling_face_with_three_hearts: :confetti_ball: :sunglasses: :nose: :pirate_flag: :neutral_face: :sweat_smile: :gift: :pensive: :dark_sunglasses: :exclamation: :call_me_hand: :green_heart: :face_with_monocle: :blush: :boom: :hugs: :stuck_out_tongue: :zipper_mouth_face: :slightly_frowning_face: :face_with_raised_eyebrow: :exploding_head: :information_source: :sailboat: :fire: :gun: :carousel_horse: :sparkles: :hearts: :pizza: :frowning: :drooling_face: :-1: :100: :metal: :partying_face: :four_leaf_clover: :grinning_face_with_smiling_eyes: :scream_cat: :person_shrugging: :deciduous_tree: :sunflower: :see_no_evil: :hear_no_evil: :speak_no_evil: :微笑: :top: :face_with_peeking_eye: :face_with_hand_over_mouth: :stethoscope: :money_mouth_face:

To get a bullet list of emojis with the number of instances of each:

retorts.keys.sort.each do |k|
  puts "* :#{k}: #{retorts[k].length}"

I won’t paste the whole bullet list of emoji, but it starts like this:

  • :+1: 161
  • :-1: 1
  • :100: 1
  • :arrow_right_hook: 1
  • :astonished: 9
  • :blush: 2
  • :boom: 2
  • :brain: 23
  • :bulb: 3

If you want to see every post that exists for each emoji:

retorts.keys.sort.each do |k|
  puts "* :#{k}: #{retorts[k].length}"
  retorts[k].each do |r|
    p = Post.find_by(id: r.post_id)
    next if p.nil?
    puts "   * #{p.full_url}"

That’s way too long to paste here!

What I don’t know is how to migrate all — or some of — those retorts to reactions. There is no mention of retort in the reactions plugin so it doesn’t do it automatically. I have 927 reactions with 116 unique emoji that I’d like to migrate to reactions.

I expect that I’ll be faced with dealing this at some point, preferably before Retort just quits working; if I implement the migration I’ll plan to document it here. But at least knowing what you have might help you.


In writing some experimental code to migrate Retort to Reactions, I have discovered that Retorts aren’t updated when usernames are changed.

I think that this will not be true with Reactions because PostActions joins to actual user records, rather than recording user names in a JSON blob in PostDetail.

In general, if someone decided that they wanted to adopt and maintain Retort, they should consider migrating from PostDetail to PostActions following how Reactions was done.

Similarly, it does not recognize when posts are deleted.

My Script framework to rearrange topics and categories has grown a new function that goes a little beyond rearranging topics and categories!

I usually remember to warn folks that I don’t know ruby or ruby on rails, so my code is idiosyncratic rather than idiomatic. But it seems to work so far in my testing!

  def migrateRetortToReactions(allowed:, likes: nil, emojimap: nil)
    # migrate where possible without overriding any existing likes
    # this is a necessarily lossy conversion, and is consistent only by ordering of PostDetail
    # no attempt is made to prefer one PostDetail record over another
    emojimap = {} if emojimap.nil?
    allowed.each do |a|
      emojimap[a] = a
    retort = "retort".freeze
    emojiType = "emoji".freeze
    usermap = { |hash, username| hash[username] = User.find_by_username(username) }
    postmap = { |hash, post_id| hash[post_id] = Post.find(post_id) }
    likeType = PostActionType.where(name_key: "like").pluck(:id).first

    PostDetail.where(extra: retort).each do |pd|
        p = postmap[pd.post_id]
        # PostDetail not consistent WRT delete
        $stderr.puts sprintf("Could not find post for %d: %s / %s", pd.post_id, pd.key, pd.value)
      emoji = pd.key.split('|').first
      users = JSON.parse(pd.value)
      users.each do |user|
        u = usermap[user]
        next if u.nil? # changed user name or deleted user leaves orphaned Retorts
        if likes.include?(emoji)
          pa = PostAction.where(post_id:, user_id:, post_action_type_id: likeType).first
          next unless pa.nil?
          $stderr.puts sprintf("Adding like for Retort %s for user %s in %s", emoji, user, p.url)
          PostActionCreator.create(u, p, :like, created_at: pd.created_at, silent: true)
        elsif emojimap.has_key?(emoji)
          e = emojimap[emoji]
          r = DiscourseReactions::Reaction.where(post_id:, reaction_type: emojiType, reaction_value: e).first_or_create
          ru = DiscourseReactions::ReactionUser.where(user_id:, post_id:
          next unless ru.nil?
          $stderr.puts sprintf("Converting Retort %s to Reaction %s for user %s in %s", emoji, e, user, p.url)
          DiscourseReactions::ReactionUser.create(reaction_id:, user_id:, post_id:, created_at: pd.created_at)
          $stderr.puts sprintf("Ignoring unmapped Retort %s for user %s in %s", emoji, user, p.url)

I use the framework I built to provide a yaml configuration that looks like this:

- migrateRetortToReactions:
      - rofl
      - astonished
      - crossed_fingers
      - sob
      - thinking
      - grimacing
      - frowning_face
      - drum
      - dart
      - +1
      - joy
      - "100"
      - brain
      - heart
      - heart_eyes
      - hearts
      rage: sob
      four_leaf_clover: crossed_fingers
      cry: sob
      open_mouth: astonished
      scream: frowning_face

However, you could just wrap that up in a ruby script including making those arguments literal ruby code, drop it in the script/ directory, and run it.


Hey guys, as discussed in the topic above I’ve already written a migration feature of Retort to Reactions, including an admin UI.

For it to be production ready the maintainers of Reactions will need to make a slight change to improve the abstraction of the code in the Reactions plugin.

Supporting a production level migration between two plugins like this requires significant quality assurance otherwise issues like this can easily occur.


I’m sorry! I had missed those post and had merely looked in the main branch. It’s a long thread…

I agree. I completely side-stepped it. It’s more than just ReactionManager.toggle! though — it really needs to pass through created_at doesn’t it?

The move to Reactions really changes the semantics of “like” because you can’t take it back when someone edits their post. I would not have made the same implementation choice. :frowning:

In any case, what I want to do is drive this from a script, and I have no interest whatsoever in driving it from a UI. I’m not the target audience for the UI, so maybe my hack being available doesn’t hurt.

1 Like

By all means, I didn’t mean to discourage you writing it for your own purposes, but I wouldn’t advise other sites to use it unless they’re familiar with the code and the data structure.

The bottom line is that the Reactions Plugin isn’t currently written in a way conducive to a stable migration that will work reliably across environments.

If anyone wishes to migrate from Retort to Reactions, Pavilion is handling these manually on a contract basis (email or PM me). If the Reactions Plugin is updated to allow for generalized migrations we’ll complete the migration work to make this freely available.


Aha. This answers some questions I’ve had. It’s hard to make sense of 450 posts over 7 years.

So do I understand that what “needs” to happen (anyone is welcome to supply their own definition of “needs”) is to somehow extend Reactions so that it can more cleanly handle migrating data to it and also providing features that it is missing?

How big a job is that in some wild guess of hours or dollars?

This is broadly still accurate.

If the opportunity for a PR is realistically there I’d probably just do it for a good bottle of red. It is Friday night after all.

But, being slightly more serious, what we’re talking about here is a minor refactor of the Reactions plugin ReactionManager. That kind of work is typically not accepted via PR. There would need to be buy-in from the maintainers of Reactions.

I think you also would want to make sure the likes are silent and created_at is handled for likes and reactions; otherwise users are spammed with notifications from the migration. (I saw this in my test site for my own login.)

For some reason, even with created_by handled, I still trigger the out of love max likes, and I didn’t investigate further, because I got rid of all the other notifications.

@joffreyjaffeux any reason not to expose the necessary functionality for a clean migration?