diff options
author | Jesús Espino <jespinog@gmail.com> | 2018-08-24 09:53:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-24 09:53:44 +0200 |
commit | bba3bbd9f3e250cca0ce705e664382fe3ad6e78a (patch) | |
tree | 63b8e40450634949d6bc3f80346cd26b7639c49d /store/sqlstore | |
parent | 8bbee74ed811e7aa8167ad7cea6d05042a90f446 (diff) | |
download | chat-bba3bbd9f3e250cca0ce705e664382fe3ad6e78a.tar.gz chat-bba3bbd9f3e250cca0ce705e664382fe3ad6e78a.tar.bz2 chat-bba3bbd9f3e250cca0ce705e664382fe3ad6e78a.zip |
MM-11572: Force correct order on messages generated in the bulk (#9244)
Diffstat (limited to 'store/sqlstore')
-rw-r--r-- | store/sqlstore/channel_store.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go index e158ba5ea..97f60dda0 100644 --- a/store/sqlstore/channel_store.go +++ b/store/sqlstore/channel_store.go @@ -1921,3 +1921,11 @@ func (s SqlChannelStore) ClearAllCustomRoleAssignments() store.StoreChannel { } }) } + +func (s SqlChannelStore) ResetLastPostAt() store.StoreChannel { + return store.Do(func(result *store.StoreResult) { + if _, err := s.GetMaster().Exec("UPDATE Channels SET LastPostAt = (SELECT UpdateAt FROM Posts WHERE ChannelId = Channels.Id ORDER BY UpdateAt DESC LIMIT 1);"); err != nil { + result.Err = model.NewAppError("SqlChannelStore.ResetLastPostAt", "store.sql_channel.reset_last_post_at.app_error", nil, err.Error(), http.StatusInternalServerError) + } + }) +} |