Adds an exported const string that can be used by plugins to signal a client that the incoming post should be dismissed, instead of the current behavior which just leaves it pending.
Этот коммит содержится в:
коммит произвёл
Hanzei
родитель
16c11d7bf9
Коммит
c73bc21d1e
@@ -236,7 +236,11 @@ func (a *App) CreatePost(post *model.Post, channel *model.Channel, triggerWebhoo
|
||||
pluginsEnvironment.RunMultiPluginHook(func(hooks plugin.Hooks) bool {
|
||||
replacementPost, rejectionReason := hooks.MessageWillBePosted(pluginContext, post)
|
||||
if rejectionReason != "" {
|
||||
rejectionError = model.NewAppError("createPost", "Post rejected by plugin. "+rejectionReason, nil, "", http.StatusBadRequest)
|
||||
id := "Post rejected by plugin. " + rejectionReason
|
||||
if rejectionReason == plugin.DismissPostError {
|
||||
id = plugin.DismissPostError
|
||||
}
|
||||
rejectionError = model.NewAppError("createPost", id, nil, "", http.StatusBadRequest)
|
||||
return false
|
||||
}
|
||||
if replacementPost != nil {
|
||||
@@ -245,6 +249,7 @@ func (a *App) CreatePost(post *model.Post, channel *model.Channel, triggerWebhoo
|
||||
|
||||
return true
|
||||
}, plugin.MessageWillBePostedId)
|
||||
|
||||
if rejectionError != nil {
|
||||
return nil, rejectionError
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user