From 07b14c370a6c911c89e1812bc796a445e5223604 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Tue, 27 Mar 2018 21:14:42 +0800 Subject: post a system message after a channel is converted from public to private (#8501) --- api4/channel.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'api4/channel.go') diff --git a/api4/channel.go b/api4/channel.go index 29dff883f..d587ddc72 100644 --- a/api4/channel.go +++ b/api4/channel.go @@ -118,6 +118,7 @@ func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) { oldChannel.Purpose = channel.Purpose oldChannelDisplayName := oldChannel.DisplayName + oldChannelType := oldChannel.Type if len(channel.DisplayName) > 0 { oldChannel.DisplayName = channel.DisplayName @@ -140,6 +141,13 @@ func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) { l4g.Error(err.Error()) } } + + if oldChannelType == model.CHANNEL_OPEN && channel.Type == model.CHANNEL_PRIVATE { + if err := c.App.PostConvertChannelToPrivate(c.Session.UserId, channel); err != nil { + l4g.Error(err.Error()) + } + } + c.LogAudit("name=" + channel.Name) w.Write([]byte(oldChannel.ToJson())) } -- cgit v1.2.3-1-g7c22