summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/channel.go5
-rw-r--r--api/channel_test.go9
2 files changed, 14 insertions, 0 deletions
diff --git a/api/channel.go b/api/channel.go
index e2ddc72bc..538c2d497 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -338,7 +338,12 @@ func PostUpdateChannelHeaderMessage(c *Context, channelId string, oldChannelHead
Message: message,
Type: model.POST_HEADER_CHANGE,
UserId: c.Session.UserId,
+ Props: model.StringInterface{
+ "old_header": oldChannelHeader,
+ "new_header": newChannelHeader,
+ },
}
+
if _, err := CreatePost(c, post, false); err != nil {
l4g.Error(utils.T("api.channel.post_update_channel_header_message_and_forget.join_leave.error"), err)
}
diff --git a/api/channel_test.go b/api/channel_test.go
index a3f3e211c..1d0f0270d 100644
--- a/api/channel_test.go
+++ b/api/channel_test.go
@@ -379,6 +379,15 @@ func TestUpdateChannelHeader(t *testing.T) {
upChannel1 = result.Data.(*model.Channel)
}
+ r1 := Client.Must(Client.GetPosts(channel1.Id, 0, 1, "")).Data.(*model.PostList)
+ if len(r1.Order) != 1 {
+ t.Fatal("Header update system message was not found")
+ } else if val, ok := r1.Posts[r1.Order[0]].Props["old_header"]; !ok || val != "" {
+ t.Fatal("Props should contain old_header with old header value")
+ } else if val, ok := r1.Posts[r1.Order[0]].Props["new_header"]; !ok || val != "new header" {
+ t.Fatal("Props should contain new_header with new header value")
+ }
+
if upChannel1.Header != data["channel_header"] {
t.Fatal("Failed to update header")
}