summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/channel.go16
-rw-r--r--app/team.go7
2 files changed, 22 insertions, 1 deletions
diff --git a/app/channel.go b/app/channel.go
index 1f5d308bf..025eccfcd 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -866,3 +866,19 @@ func ViewChannel(view *model.ChannelView, teamId string, userId string, clearPus
return nil
}
+
+func PermanentDeleteChannel(channel *model.Channel) *model.AppError {
+ if result := <-Srv.Store.Post().PermanentDeleteByChannel(channel.Id); result.Err != nil {
+ return result.Err
+ }
+
+ if result := <-Srv.Store.Channel().PermanentDeleteMembersByChannel(channel.Id); result.Err != nil {
+ return result.Err
+ }
+
+ if result := <-Srv.Store.Channel().PermanentDelete(channel.Id); result.Err != nil {
+ return result.Err
+ }
+
+ return nil
+}
diff --git a/app/team.go b/app/team.go
index 6225f3ee0..c1560d45a 100644
--- a/app/team.go
+++ b/app/team.go
@@ -539,8 +539,13 @@ func PermanentDeleteTeam(team *model.Team) *model.AppError {
return result.Err
}
- if result := <-Srv.Store.Channel().PermanentDeleteByTeam(team.Id); result.Err != nil {
+ if result := <-Srv.Store.Channel().GetTeamChannels(team.Id); result.Err != nil {
return result.Err
+ } else {
+ channels := result.Data.(*model.ChannelList)
+ for _, c := range *channels {
+ PermanentDeleteChannel(c)
+ }
}
if result := <-Srv.Store.Team().RemoveAllMembersByTeam(team.Id); result.Err != nil {