summaryrefslogtreecommitdiffstats
path: root/api4/channel.go
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2018-03-27 21:14:42 +0800
committerGitHub <noreply@github.com>2018-03-27 21:14:42 +0800
commit07b14c370a6c911c89e1812bc796a445e5223604 (patch)
treed8ad9a5373db49c10d347bd8e2ea06b9cd5c8fed /api4/channel.go
parent9e6db178b09387e21ac19ce85369cf1ca7a443e8 (diff)
downloadchat-07b14c370a6c911c89e1812bc796a445e5223604.tar.gz
chat-07b14c370a6c911c89e1812bc796a445e5223604.tar.bz2
chat-07b14c370a6c911c89e1812bc796a445e5223604.zip
post a system message after a channel is converted from public to private (#8501)
Diffstat (limited to 'api4/channel.go')
-rw-r--r--api4/channel.go8
1 files changed, 8 insertions, 0 deletions
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()))
}