mattermost/mattermost-server

[webapp plugin] Unable to get a callback when a message is updated

aguinet opened this issue · 3 comments

Disclamer: I'm not sure whether I should file this as a bug or feature request, but a discussion on the Mattermost toolkit channel suggested posting this here.

Summary

For a webapp plugin, it seems to be impossible to get a hook called when a message will be updated.

Steps to reproduce

Create a plugin that registers on registry.registerMessageWillBePostedHook. It works when a message is sent, but it isn't called when a message is updated.

Expected behavior

We use this for an end-to-end encryption plugin, and this issue makes it impossible to modify encrypted messages. I guess two behaviors can be expected:

  1. registerMessageWillBePostedHook is also called when messages are updated, with a flag somehow that says that this is while updating a message
  2. having a separate hook mechanism, like 'registerMessageWillBeUpdatedHook'

Observed behavior (that appears unintentional)

No callbacks can be called when a message is updated.

@aguinet Just letting you know this has been merged today (in mattermost/mattermost-webapp#8849) so expect to have this available in future MM versions. I am going to close this now.

@streamer45 This is very nice & cool, thanks a lot! I am looking forward to see this in the next mattermost release :)