From 0685afd1d197584e78a111934754d7111bb2dbe8 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Tue, 17 Jan 2017 20:45:18 +0000 Subject: PLT-2978: Add channel purpose change system message. (#5094) Completes original patch by David Lu. --- api/channel.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'api/channel.go') diff --git a/api/channel.go b/api/channel.go index 590409921..b8b73bf38 100644 --- a/api/channel.go +++ b/api/channel.go @@ -262,6 +262,7 @@ func updateChannelHeader(c *Context, w http.ResponseWriter, r *http.Request) { } func updateChannelPurpose(c *Context, w http.ResponseWriter, r *http.Request) { + props := model.MapFromJson(r.Body) channelId := props["channel_id"] if len(channelId) != 26 { @@ -292,6 +293,7 @@ func updateChannelPurpose(c *Context, w http.ResponseWriter, r *http.Request) { return } + oldChannelPurpose := channel.Purpose channel.Purpose = channelPurpose app.InvalidateCacheForChannel(channel.Id) @@ -299,6 +301,9 @@ func updateChannelPurpose(c *Context, w http.ResponseWriter, r *http.Request) { c.Err = ucresult.Err return } else { + if err := app.PostUpdateChannelPurposeMessage(c.Session.UserId, channel.Id, c.TeamId, oldChannelPurpose, channelPurpose); err != nil { + l4g.Error(err.Error()) + } c.LogAudit("name=" + channel.Name) w.Write([]byte(channel.ToJson())) } -- cgit v1.2.3-1-g7c22