mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-15292: migrate commandstore.PermanentDeleteByTeam to sync by default (#10743)
This commit is contained in:
@@ -1105,8 +1105,8 @@ func (a *App) PermanentDeleteTeam(team *model.Team) *model.AppError {
|
||||
return result.Err
|
||||
}
|
||||
|
||||
if result := <-a.Srv.Store.Command().PermanentDeleteByTeam(team.Id); result.Err != nil {
|
||||
return result.Err
|
||||
if err := a.Srv.Store.Command().PermanentDeleteByTeam(team.Id); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if result := <-a.Srv.Store.Team().PermanentDelete(team.Id); result.Err != nil {
|
||||
|
||||
@@ -111,13 +111,12 @@ func (s SqlCommandStore) Delete(commandId string, time int64) store.StoreChannel
|
||||
})
|
||||
}
|
||||
|
||||
func (s SqlCommandStore) PermanentDeleteByTeam(teamId string) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
_, err := s.GetMaster().Exec("DELETE FROM Commands WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId})
|
||||
if err != nil {
|
||||
result.Err = model.NewAppError("SqlCommandStore.DeleteByTeam", "store.sql_command.save.delete_perm.app_error", nil, "id="+teamId+", err="+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
})
|
||||
func (s SqlCommandStore) PermanentDeleteByTeam(teamId string) *model.AppError {
|
||||
_, err := s.GetMaster().Exec("DELETE FROM Commands WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId})
|
||||
if err != nil {
|
||||
return model.NewAppError("SqlCommandStore.DeleteByTeam", "store.sql_command.save.delete_perm.app_error", nil, "id="+teamId+", err="+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s SqlCommandStore) PermanentDeleteByUser(userId string) *model.AppError {
|
||||
|
||||
@@ -414,7 +414,7 @@ type CommandStore interface {
|
||||
GetByTeam(teamId string) ([]*model.Command, *model.AppError)
|
||||
GetByTrigger(teamId string, trigger string) StoreChannel
|
||||
Delete(commandId string, time int64) StoreChannel
|
||||
PermanentDeleteByTeam(teamId string) StoreChannel
|
||||
PermanentDeleteByTeam(teamId string) *model.AppError
|
||||
PermanentDeleteByUser(userId string) *model.AppError
|
||||
Update(hook *model.Command) (*model.Command, *model.AppError)
|
||||
AnalyticsCommandCount(teamId string) StoreChannel
|
||||
|
||||
@@ -186,8 +186,8 @@ func testCommandStoreDeleteByTeam(t *testing.T, ss store.Store) {
|
||||
}
|
||||
}
|
||||
|
||||
if r2 := <-ss.Command().PermanentDeleteByTeam(o1.TeamId); r2.Err != nil {
|
||||
t.Fatal(r2.Err)
|
||||
if err := ss.Command().PermanentDeleteByTeam(o1.TeamId); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if r3 := (<-ss.Command().Get(o1.Id)); r3.Err == nil {
|
||||
|
||||
@@ -103,15 +103,15 @@ func (_m *CommandStore) GetByTrigger(teamId string, trigger string) store.StoreC
|
||||
}
|
||||
|
||||
// PermanentDeleteByTeam provides a mock function with given fields: teamId
|
||||
func (_m *CommandStore) PermanentDeleteByTeam(teamId string) store.StoreChannel {
|
||||
func (_m *CommandStore) PermanentDeleteByTeam(teamId string) *model.AppError {
|
||||
ret := _m.Called(teamId)
|
||||
|
||||
var r0 store.StoreChannel
|
||||
if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok {
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
|
||||
r0 = rf(teamId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(store.StoreChannel)
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user