diff options
author | Jesse Hallam <jesse.hallam@gmail.com> | 2018-05-23 10:28:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-23 10:28:19 -0400 |
commit | 0a666a56560713a084847ce683b940c1aa84acc0 (patch) | |
tree | 016b05400fe0b5a1fc5d0300a376f9502992bb2c | |
parent | 70a118c0fd45f8ab2510c80a0110f24be21f8785 (diff) | |
download | chat-0a666a56560713a084847ce683b940c1aa84acc0.tar.gz chat-0a666a56560713a084847ce683b940c1aa84acc0.tar.bz2 chat-0a666a56560713a084847ce683b940c1aa84acc0.zip |
MM-10649: soften Channels.ExtraUpdateAt deprecation (#8843)
The previous complete removal of this field resulted in an
incompatibility with 4.x servers that could not handle the now null
column field.
Instead, ensure this field is at least always set to 0, with a plan to
remove it altogether in a future release.
-rw-r--r-- | model/channel.go | 2 | ||||
-rw-r--r-- | store/storetest/channel_store.go | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/model/channel.go b/model/channel.go index 749b8dc94..950e910dd 100644 --- a/model/channel.go +++ b/model/channel.go @@ -44,6 +44,7 @@ type Channel struct { Purpose string `json:"purpose"` LastPostAt int64 `json:"last_post_at"` TotalMsgCount int64 `json:"total_msg_count"` + ExtraUpdateAt int64 `json:"extra_update_at"` CreatorId string `json:"creator_id"` } @@ -132,6 +133,7 @@ func (o *Channel) PreSave() { o.CreateAt = GetMillis() o.UpdateAt = o.CreateAt + o.ExtraUpdateAt = 0 } func (o *Channel) PreUpdate() { diff --git a/store/storetest/channel_store.go b/store/storetest/channel_store.go index ccb7b87b8..9abb62856 100644 --- a/store/storetest/channel_store.go +++ b/store/storetest/channel_store.go @@ -713,6 +713,9 @@ func testChannelMemberStore(t *testing.T, ss store.Store) { c1.Type = model.CHANNEL_OPEN c1 = *store.Must(ss.Channel().Save(&c1, -1)).(*model.Channel) + c1t1 := (<-ss.Channel().Get(c1.Id, false)).Data.(*model.Channel) + assert.EqualValues(t, 0, c1t1.ExtraUpdateAt, "ExtraUpdateAt should be 0") + u1 := model.User{} u1.Email = model.NewId() u1.Nickname = model.NewId() @@ -737,6 +740,9 @@ func testChannelMemberStore(t *testing.T, ss store.Store) { o2.NotifyProps = model.GetDefaultChannelNotifyProps() store.Must(ss.Channel().SaveMember(&o2)) + c1t2 := (<-ss.Channel().Get(c1.Id, false)).Data.(*model.Channel) + assert.EqualValues(t, 0, c1t2.ExtraUpdateAt, "ExtraUpdateAt should be 0") + count := (<-ss.Channel().GetMemberCount(o1.ChannelId, true)).Data.(int64) if count != 2 { t.Fatal("should have saved 2 members") @@ -767,6 +773,9 @@ func testChannelMemberStore(t *testing.T, ss store.Store) { t.Fatal("should have removed 1 member") } + c1t3 := (<-ss.Channel().Get(c1.Id, false)).Data.(*model.Channel) + assert.EqualValues(t, 0, c1t3.ExtraUpdateAt, "ExtraUpdateAt should be 0") + member := (<-ss.Channel().GetMember(o1.ChannelId, o1.UserId)).Data.(*model.ChannelMember) if member.ChannelId != o1.ChannelId { t.Fatal("should have go member") @@ -775,6 +784,9 @@ func testChannelMemberStore(t *testing.T, ss store.Store) { if err := (<-ss.Channel().SaveMember(&o1)).Err; err == nil { t.Fatal("Should have been a duplicate") } + + c1t4 := (<-ss.Channel().Get(c1.Id, false)).Data.(*model.Channel) + assert.EqualValues(t, 0, c1t4.ExtraUpdateAt, "ExtraUpdateAt should be 0") } func testChannelDeleteMemberStore(t *testing.T, ss store.Store) { @@ -785,6 +797,9 @@ func testChannelDeleteMemberStore(t *testing.T, ss store.Store) { c1.Type = model.CHANNEL_OPEN c1 = *store.Must(ss.Channel().Save(&c1, -1)).(*model.Channel) + c1t1 := (<-ss.Channel().Get(c1.Id, false)).Data.(*model.Channel) + assert.EqualValues(t, 0, c1t1.ExtraUpdateAt, "ExtraUpdateAt should be 0") + u1 := model.User{} u1.Email = model.NewId() u1.Nickname = model.NewId() @@ -809,6 +824,9 @@ func testChannelDeleteMemberStore(t *testing.T, ss store.Store) { o2.NotifyProps = model.GetDefaultChannelNotifyProps() store.Must(ss.Channel().SaveMember(&o2)) + c1t2 := (<-ss.Channel().Get(c1.Id, false)).Data.(*model.Channel) + assert.EqualValues(t, 0, c1t2.ExtraUpdateAt, "ExtraUpdateAt should be 0") + count := (<-ss.Channel().GetMemberCount(o1.ChannelId, false)).Data.(int64) if count != 2 { t.Fatal("should have saved 2 members") |