From 72f61ab96aabf65c162c8d94b5b843b5108ee1a9 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 31 Jul 2017 08:52:45 -0700 Subject: make cli team / channel delete operations also delete webhooks and slash commands (#7028) --- store/sql_command_store.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'store/sql_command_store.go') diff --git a/store/sql_command_store.go b/store/sql_command_store.go index a80d1dbf4..6b2338380 100644 --- a/store/sql_command_store.go +++ b/store/sql_command_store.go @@ -134,6 +134,24 @@ func (s SqlCommandStore) Delete(commandId string, time int64) StoreChannel { return storeChannel } +func (s SqlCommandStore) PermanentDeleteByTeam(teamId string) StoreChannel { + storeChannel := make(StoreChannel, 1) + + go func() { + result := StoreResult{} + + _, err := s.GetMaster().Exec("DELETE FROM Commands WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId}) + if err != nil { + result.Err = model.NewLocAppError("SqlCommandStore.DeleteByTeam", "store.sql_command.save.delete_perm.app_error", nil, "id="+teamId+", err="+err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (s SqlCommandStore) PermanentDeleteByUser(userId string) StoreChannel { storeChannel := make(StoreChannel, 1) -- cgit v1.2.3-1-g7c22