[MM-54495] Fix update post plugin hooks (#24602)

* Fix updatePost props and plugin hooks

* Add more tests

* Minor naming improvement

* Revert props related changes

* Fix test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Daniel Espino García
2023-10-26 15:15:00 +02:00
коммит произвёл GitHub
родитель 6649bbebb8
Коммит cee4411355
3 изменённых файлов: 147 добавлений и 3 удалений

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

@@ -702,7 +702,7 @@ func (a *App) UpdatePost(c *request.Context, receivedUpdatedPost *model.Post, sa
pluginContext := pluginContext(c)
a.ch.RunMultiHook(func(hooks plugin.Hooks) bool {
newPost, rejectionReason = hooks.MessageWillBeUpdated(pluginContext, newPost.ForPlugin(), oldPost.ForPlugin())
return receivedUpdatedPost != nil
return newPost != nil
}, plugin.MessageWillBeUpdatedID)
if newPost == nil {
return nil, model.NewAppError("UpdatePost", "Post rejected by plugin. "+rejectionReason, nil, "", http.StatusBadRequest)