Invalidate webhook cache after updating webhook (#7430)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9fc7845112
Коммит
23e64ec9aa
@@ -8,6 +8,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/model"
|
"github.com/mattermost/mattermost-server/model"
|
||||||
"github.com/mattermost/mattermost-server/utils"
|
"github.com/mattermost/mattermost-server/utils"
|
||||||
)
|
)
|
||||||
@@ -503,6 +505,9 @@ func TestUpdateIncomingHook(t *testing.T) {
|
|||||||
} else {
|
} else {
|
||||||
t.Fatal("should not be nil")
|
t.Fatal("should not be nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//updatedHook, _ = th.App.GetIncomingWebhook(createdHook.Id)
|
||||||
|
assert.Equal(t, updatedHook.ChannelId, createdHook.ChannelId)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("RetainCreateAt", func(t *testing.T) {
|
t.Run("RetainCreateAt", func(t *testing.T) {
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ func (a *App) UpdateIncomingWebhook(oldHook, updatedHook *model.IncomingWebhook)
|
|||||||
if result := <-a.Srv.Store.Webhook().UpdateIncoming(updatedHook); result.Err != nil {
|
if result := <-a.Srv.Store.Webhook().UpdateIncoming(updatedHook); result.Err != nil {
|
||||||
return nil, result.Err
|
return nil, result.Err
|
||||||
} else {
|
} else {
|
||||||
|
a.InvalidateCacheForWebhook(oldHook.Id)
|
||||||
return result.Data.(*model.IncomingWebhook), nil
|
return result.Data.(*model.IncomingWebhook), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user