GH-15624: Added plugin hooks for ReationHasBeenAdded and ReactionHasBeenRemoved (#15765)

Этот коммит содержится в:
Jared Shields
2020-10-31 02:06:43 -04:00
коммит произвёл GitHub
родитель 71c371509b
Коммит 3515b4d6c9
6 изменённых файлов: 234 добавлений и 19 удалений

Просмотреть файл

@@ -15,25 +15,27 @@ import (
// Feel free to add more, but do not change existing assignments. Follow the naming convention of
// <HookName>Id as the autogenerated glue code depends on that.
const (
OnActivateId = 0
OnDeactivateId = 1
ServeHTTPId = 2
OnConfigurationChangeId = 3
ExecuteCommandId = 4
MessageWillBePostedId = 5
MessageWillBeUpdatedId = 6
MessageHasBeenPostedId = 7
MessageHasBeenUpdatedId = 8
UserHasJoinedChannelId = 9
UserHasLeftChannelId = 10
UserHasJoinedTeamId = 11
UserHasLeftTeamId = 12
ChannelHasBeenCreatedId = 13
FileWillBeUploadedId = 14
UserWillLogInId = 15
UserHasLoggedInId = 16
UserHasBeenCreatedId = 17
TotalHooksId = iota
OnActivateId = 0
OnDeactivateId = 1
ServeHTTPId = 2
OnConfigurationChangeId = 3
ExecuteCommandId = 4
MessageWillBePostedId = 5
MessageWillBeUpdatedId = 6
MessageHasBeenPostedId = 7
MessageHasBeenUpdatedId = 8
UserHasJoinedChannelId = 9
UserHasLeftChannelId = 10
UserHasJoinedTeamId = 11
UserHasLeftTeamId = 12
ChannelHasBeenCreatedId = 13
FileWillBeUploadedId = 14
UserWillLogInId = 15
UserHasLoggedInId = 16
UserHasBeenCreatedId = 17
ReactionHasBeenAddedId = 18
ReactionHasBeenRemovedId = 19
TotalHooksId = iota
)
const (
@@ -191,4 +193,20 @@ type Hooks interface {
//
// Minimum server version: 5.2
FileWillBeUploaded(c *Context, info *model.FileInfo, file io.Reader, output io.Writer) (*model.FileInfo, string)
// ReactionHasBeenAdded is invoked after the reaction has been committed to the database.
//
// Note that this method will be called for reactions added by plugins, including the plugin that
// added the reaction.
//
// Minimum server version: 5.30
ReactionHasBeenAdded(c *Context, reaction *model.Reaction)
// ReactionHasBeenRemoved is invoked after the removal of the reaction has been committed to the database.
//
// Note that this method will be called for reactions removed by plugins, including the plugin that
// removed the reaction.
//
// Minimum server version: 5.30
ReactionHasBeenRemoved(c *Context, reaction *model.Reaction)
}