Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MM-28247 Threads metadata table #15571

Merged
merged 13 commits into from Oct 1, 2020
24 changes: 24 additions & 0 deletions model/thread.go
@@ -0,0 +1,24 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

package model

import (
"encoding/json"
)

type Thread struct {
PostId string `json:"id"`
ReplyCount int64 `json:"reply_count"`
LastReplyAt int64 `json:"last_reply_at"`
Participants StringArray `json:"participants"`
}

func (o *Thread) ToJson() string {
b, _ := json.Marshal(o)
return string(b)
}

func (o *Thread) Etag() string {
return Etag(o.PostId, o.LastReplyAt)
}
20 changes: 20 additions & 0 deletions model/utils.go
Expand Up @@ -36,6 +36,26 @@ type StringInterface map[string]interface{}
type StringMap map[string]string
type StringArray []string

func (sa StringArray) Remove(input string) StringArray {
for index := range sa {
if sa[index] == input {
ret := make(StringArray, 0, len(sa)-1)
ret = append(ret, sa[:index]...)
return append(ret, sa[index+1:]...)
}
}
return sa
}

func (sa StringArray) Contains(input string) bool {
for index := range sa {
if sa[index] == input {
return true
}
}

return false
}
func (sa StringArray) Equals(input StringArray) bool {

if len(sa) != len(input) {
Expand Down
101 changes: 101 additions & 0 deletions store/opentracinglayer/opentracinglayer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 111 additions & 0 deletions store/retrylayer/retrylayer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions store/retrylayer/retrylayer_test.go
Expand Up @@ -33,6 +33,7 @@ func genStore() *mocks.Store {
mock.On("OAuth").Return(&mocks.OAuthStore{})
mock.On("Plugin").Return(&mocks.PluginStore{})
mock.On("Post").Return(&mocks.PostStore{})
mock.On("Thread").Return(&mocks.ThreadStore{})
mock.On("Preference").Return(&mocks.PreferenceStore{})
mock.On("ProductNotices").Return(&mocks.ProductNoticesStore{})
mock.On("Reaction").Return(&mocks.ReactionStore{})
Expand Down