MM 15185 - Migrate "WebHook.GetOutgoingByChannel" to Sync by default (#10704)

Этот коммит содержится в:
Puneeth Reddy
2019-05-07 04:50:03 -07:00
коммит произвёл Hanzei
родитель 6d336e0666
Коммит 4f7f7070c0
6 изменённых файлов: 42 добавлений и 33 удалений

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

@@ -793,13 +793,20 @@ func (a *App) UpdateChannelMemberNotifyProps(data map[string]string, channelId s
func (a *App) DeleteChannel(channel *model.Channel, userId string) *model.AppError {
ihc := make(chan store.StoreResult, 1)
ohc := a.Srv.Store.Webhook().GetOutgoingByChannel(channel.Id, -1, -1)
ohc := make(chan store.StoreResult, 1)
go func() {
webhooks, err := a.Srv.Store.Webhook().GetIncomingByChannel(channel.Id)
ihc <- store.StoreResult{Data: webhooks, Err: err}
close(ihc)
}()
go func() {
outgoingHooks, err := a.Srv.Store.Webhook().GetOutgoingByChannel(channel.Id, -1, -1)
ohc <- store.StoreResult{Data: outgoingHooks, Err: err}
close(ohc)
}()
var user *model.User
if userId != "" {
var err *model.AppError

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

@@ -503,11 +503,7 @@ func (a *App) GetOutgoingWebhooksForChannelPage(channelId string, page, perPage
return nil, model.NewAppError("GetOutgoingWebhooksForChannelPage", "api.outgoing_webhook.disabled.app_error", nil, "", http.StatusNotImplemented)
}
if result := <-a.Srv.Store.Webhook().GetOutgoingByChannel(channelId, page*perPage, perPage); result.Err != nil {
return nil, result.Err
} else {
return result.Data.([]*model.OutgoingWebhook), nil
}
return a.Srv.Store.Webhook().GetOutgoingByChannel(channelId, page*perPage, perPage)
}
func (a *App) GetOutgoingWebhooksForTeamPage(teamId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) {