MM-24575 handle auto-respond to self (#14410)

Этот коммит содержится в:
Doug Lauder
2020-04-29 14:19:18 -04:00
коммит произвёл GitHub
родитель f85cbf6b5c
Коммит a3cf490a4d
2 изменённых файлов: 12 добавлений и 6 удалений

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

@@ -18,6 +18,10 @@ func (a *App) SendAutoResponseIfNecessary(channel *model.Channel, sender *model.
}
receiverId := channel.GetOtherUserIdForDM(sender.Id)
if receiverId == "" {
// User direct messaged themself, let them test their auto-responder.
receiverId = sender.Id
}
receiver, err := a.GetUser(receiverId)
if err != nil {

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

@@ -419,12 +419,14 @@ func (a *App) handlePostEvents(post *model.Post, user *model.User, channel *mode
return err
}
a.Srv().Go(func() {
_, err := a.SendAutoResponseIfNecessary(channel, user)
if err != nil {
mlog.Error("Failed to send auto response", mlog.String("user_id", user.Id), mlog.String("post_id", post.Id), mlog.Err(err))
}
})
if post.Type != model.POST_AUTO_RESPONDER { // don't respond to an auto-responder
a.Srv().Go(func() {
_, err := a.SendAutoResponseIfNecessary(channel, user)
if err != nil {
mlog.Error("Failed to send auto response", mlog.String("user_id", user.Id), mlog.String("post_id", post.Id), mlog.Err(err))
}
})
}
if triggerWebhooks {
a.Srv().Go(func() {