matrix-org / matrix-appservice-slack

A Matrix <--> Slack bridge
Apache License 2.0
273 stars 72 forks source link

M->S: Unsupported reactions fail silently #503

Open jaller94 opened 3 years ago

jaller94 commented 3 years ago

Describe the bug Some reactions are not supported by Slack and silently fail to bridge.

To Reproduce Steps to reproduce the behavior:

  1. On matrix make a post and react to it using 🧙 (gender-neutral mage).

Expected behavior This gets somehow bridged to Slack.

Screenshots

Matrix

Screenshot_2020-09-23_18-22-00

Slack

Screenshot_2020-09-23_18-22-09

Additional context

Sep-23 17:36:50.301 ERROR Main Failed processing reaction message:  Error: An API error occurred: invalid_name
    at Object.platformErrorFromResult (/home/jaller94/Git/matrix-appservice-slack/node_modules/@slack/web-api/dist/errors.js:51:33)
    at WebClient.apiCall (/home/jaller94/Git/matrix-appservice-slack/node_modules/@slack/web-api/dist/WebClient.js:152:28)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async BridgedRoom.onMatrixReaction (/home/jaller94/Git/matrix-appservice-slack/lib/BridgedRoom.js:246:21)
    at async Main.onMatrixEvent (/home/jaller94/Git/matrix-appservice-slack/lib/Main.js:531:17) {
  code: 'slack_webapi_platform_error',
  data: {
    ok: false,
    error: 'invalid_name',
    response_metadata: { scopes: [Array], acceptedScopes: [Array] }
  }
}
Half-Shot commented 3 years ago

I wonder what the name is. :mage: is valid on slack

Half-Shot commented 3 years ago

So trying this on Slack, they only offer female_mage and male_mage as actual names. Clicking :mage: on slack will give you female mage.

jaller94 commented 3 years ago

node-emoji wasn't able to translate it an send the Unicode 🧙

Point being, it may fail and we may want to have a fallback. (I wanted to file this without working on it right away.)

Half-Shot commented 3 years ago

Well, the best thing we can do is either ignore invalid reactions, or send a reply to the message showing the reaction.

jaller94 commented 3 years ago

Not to distract from the "There are some unsupported strings that we should better represent in Slack", but just to clarify why mage doesn't work:

The library node-emoji does not translate 🧙 to :mage: because Slack doesn't have gender-neutral reactions. Instead, looking at the inverse mapping (S->M), both :mage: and :female_mage: translate to 🧙‍♀ (female mage). https://github.com/omnidan/node-emoji/blob/master/lib/emoji.json