MM-24575 handle auto-respond to self (#14410)
Этот коммит содержится в:
@@ -18,6 +18,10 @@ func (a *App) SendAutoResponseIfNecessary(channel *model.Channel, sender *model.
|
|||||||
}
|
}
|
||||||
|
|
||||||
receiverId := channel.GetOtherUserIdForDM(sender.Id)
|
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)
|
receiver, err := a.GetUser(receiverId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
14
app/post.go
14
app/post.go
@@ -419,12 +419,14 @@ func (a *App) handlePostEvents(post *model.Post, user *model.User, channel *mode
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
a.Srv().Go(func() {
|
if post.Type != model.POST_AUTO_RESPONDER { // don't respond to an auto-responder
|
||||||
_, err := a.SendAutoResponseIfNecessary(channel, user)
|
a.Srv().Go(func() {
|
||||||
if err != nil {
|
_, err := a.SendAutoResponseIfNecessary(channel, user)
|
||||||
mlog.Error("Failed to send auto response", mlog.String("user_id", user.Id), mlog.String("post_id", post.Id), mlog.Err(err))
|
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 {
|
if triggerWebhooks {
|
||||||
a.Srv().Go(func() {
|
a.Srv().Go(func() {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user