Mattermost-server: Add OnPluginStatusesChanged hook

Created on 26 Feb 2020  Â·  6Comments  Â·  Source: mattermost/mattermost-server

Add the following hook, emitted whenever we call App.notifyPluginStatusesChanged:

func OnPluginStatusesChanged(c *Context) error

This hook event will not contain a payload: it is the responsibility of the plugin to fetch the plugin statuses so as to avoid race conditions with notifications going out. While this is currently possible via GetPlugins and a series of GetPluginStatus calls, let’s also add a plugin API method to streamline this:

func GetPluginStatuses() ([]*model.PluginStatus, *model.AppError)

Note that it’s not necessary to broadcast plugins statuses to other servers – this hook event is only local to the current server, and in fact the plugin statuses may vary between servers.


If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide.

JIRA: https://mattermost.atlassian.net/browse/MM-19267

AreToolkit Medium Help Wanted PR Exists TecGo

Most helpful comment

Thanks, @fedealconada! @joshuabezaleel already has a PR up, and I've just been iterating with some feedback on it, so I think it's in a good state for now.

All 6 comments

Hi @lieut-data , any pointer on which part of the codebase I can start reading if I am interested in this?
Thank you very much :slightly_smiling_face:

Hey @joshuabezaleel! I don't know of a resource that explains the creation of apis and hooks for plugins, but I can point you at https://github.com/mattermost/mattermost-server/pull/13647 for an example of a recently added API method, and https://github.com/mattermost/mattermost-server/pull/10178 for a recently added hook.

If you're still interested, let me know!

Hi @lieut-data , if it's okay with you I would like to ask a question.

What's the difference between the GetPluginStatuses API method that you proposed above and the one written here?

Thank you! :slightly_smiling_face:

@joshuabezaleel, the one you linked to on the App structure will indeed be the implementation for the new plugin API, but it's just not currently exposed to plugins.

if this issue is idle, I can take it @lieut-data

Thanks, @fedealconada! @joshuabezaleel already has a PR up, and I've just been iterating with some feedback on it, so I think it's in a good state for now.

Was this page helpful?
0 / 5 - 0 ratings