Invalidate webhook cache after updating webhook (#7430)

Этот коммит содержится в:
Joram Wilander
2017-09-14 11:47:34 -04:00
коммит произвёл GitHub
родитель 9fc7845112
Коммит 23e64ec9aa
2 изменённых файлов: 6 добавлений и 0 удалений

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

@@ -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
} }
} }