summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2017-01-06 15:20:02 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-06 15:20:02 -0500
commitba336dce6903b7bd14686667e2cd4f79afaaf767 (patch)
tree208f7102496d316470a78883914c79bcb9682331 /api
parent4fb9787feec2d4baccac6fb87de6f6fb88583d67 (diff)
downloadchat-ba336dce6903b7bd14686667e2cd4f79afaaf767.tar.gz
chat-ba336dce6903b7bd14686667e2cd4f79afaaf767.tar.bz2
chat-ba336dce6903b7bd14686667e2cd4f79afaaf767.zip
PLT-5079 fixing archiving channel not being removed (#5000)
Diffstat (limited to 'api')
-rw-r--r--api/channel.go47
1 files changed, 21 insertions, 26 deletions
diff --git a/api/channel.go b/api/channel.go
index 4c9e514ac..ae92ab618 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -826,47 +826,42 @@ func deleteChannel(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ post := &model.Post{
+ ChannelId: channel.Id,
+ Message: fmt.Sprintf(c.T("api.channel.delete_channel.archived"), user.Username),
+ Type: model.POST_CHANNEL_DELETED,
+ UserId: c.Session.UserId,
+ }
+
+ if _, err := CreatePost(c, post, false); err != nil {
+ l4g.Error(utils.T("api.channel.delete_channel.failed_post.error"), err)
+ }
+
now := model.GetMillis()
for _, hook := range incomingHooks {
- go func() {
- if result := <-Srv.Store.Webhook().DeleteIncoming(hook.Id, now); result.Err != nil {
- l4g.Error(utils.T("api.channel.delete_channel.incoming_webhook.error"), hook.Id)
- }
- }()
+ if result := <-Srv.Store.Webhook().DeleteIncoming(hook.Id, now); result.Err != nil {
+ l4g.Error(utils.T("api.channel.delete_channel.incoming_webhook.error"), hook.Id)
+ }
}
for _, hook := range outgoingHooks {
- go func() {
- if result := <-Srv.Store.Webhook().DeleteOutgoing(hook.Id, now); result.Err != nil {
- l4g.Error(utils.T("api.channel.delete_channel.outgoing_webhook.error"), hook.Id)
- }
- }()
+ if result := <-Srv.Store.Webhook().DeleteOutgoing(hook.Id, now); result.Err != nil {
+ l4g.Error(utils.T("api.channel.delete_channel.outgoing_webhook.error"), hook.Id)
+ }
}
- InvalidateCacheForChannel(channel.Id)
if dresult := <-Srv.Store.Channel().Delete(channel.Id, model.GetMillis()); dresult.Err != nil {
c.Err = dresult.Err
return
}
+ InvalidateCacheForChannel(channel.Id)
c.LogAudit("name=" + channel.Name)
- go func() {
- message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_DELETED, c.TeamId, "", "", nil)
- message.Add("channel_id", channel.Id)
+ message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_DELETED, c.TeamId, "", "", nil)
+ message.Add("channel_id", channel.Id)
- go Publish(message)
-
- post := &model.Post{
- ChannelId: channel.Id,
- Message: fmt.Sprintf(c.T("api.channel.delete_channel.archived"), user.Username),
- Type: model.POST_CHANNEL_DELETED,
- UserId: c.Session.UserId,
- }
- if _, err := CreatePost(c, post, false); err != nil {
- l4g.Error(utils.T("api.channel.delete_channel.failed_post.error"), err)
- }
- }()
+ Publish(message)
result := make(map[string]string)
result["id"] = channel.Id