MM-15118: Migrates the "WebHook.DeleteIncoming" to Sync by default. (#10706)

* cherry commit for DeleteIncoming and generate store mocks

* go fmt the code and fix go vet issue
Этот коммит содержится в:
Puneeth Reddy
2019-04-29 22:34:08 -07:00
коммит произвёл Jesús Espino
родитель 13403b2cc1
Коммит eb3923c835
6 изменённых файлов: 17 добавлений и 18 удалений

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

@@ -142,15 +142,14 @@ func (s SqlWebhookStore) GetIncoming(id string, allowFromCache bool) (*model.Inc
return &webhook, nil
}
func (s SqlWebhookStore) DeleteIncoming(webhookId string, time int64) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
_, err := s.GetMaster().Exec("Update IncomingWebhooks SET DeleteAt = :DeleteAt, UpdateAt = :UpdateAt WHERE Id = :Id", map[string]interface{}{"DeleteAt": time, "UpdateAt": time, "Id": webhookId})
if err != nil {
result.Err = model.NewAppError("SqlWebhookStore.DeleteIncoming", "store.sql_webhooks.delete_incoming.app_error", nil, "id="+webhookId+", err="+err.Error(), http.StatusInternalServerError)
}
func (s SqlWebhookStore) DeleteIncoming(webhookId string, time int64) *model.AppError {
_, err := s.GetMaster().Exec("Update IncomingWebhooks SET DeleteAt = :DeleteAt, UpdateAt = :UpdateAt WHERE Id = :Id", map[string]interface{}{"DeleteAt": time, "UpdateAt": time, "Id": webhookId})
if err != nil {
return model.NewAppError("SqlWebhookStore.DeleteIncoming", "store.sql_webhooks.delete_incoming.app_error", nil, "id="+webhookId+", err="+err.Error(), http.StatusInternalServerError)
}
s.InvalidateWebhookCache(webhookId)
})
s.InvalidateWebhookCache(webhookId)
return nil
}
func (s SqlWebhookStore) PermanentDeleteIncomingByUser(userId string) *model.AppError {