MM-28247 Threads metadata table (#15571)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
10961f9500
Коммит
595248b10e
24
model/thread.go
Обычный файл
24
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)
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
Ссылка в новой задаче
Block a user