Prep for MS Teams plugin API (#25565)
* - columns added to ShareChannelRemotes: lastpostcreateat, lastpostupdateat - SyncMsg and SyncResponse moved to `model` package - field added to RemoteCluster struct: PluginID * sync new posts before updated posts to ensure post order in MS Teams * add plugid to remoteclusters table and store * don't sync history by default
Этот коммит содержится в:
@@ -4,6 +4,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"unicode/utf8"
|
||||
)
|
||||
@@ -100,7 +101,9 @@ type SharedChannelRemote struct {
|
||||
IsInviteConfirmed bool `json:"is_invite_confirmed"`
|
||||
RemoteId string `json:"remote_id"`
|
||||
LastPostUpdateAt int64 `json:"last_post_update_at"`
|
||||
LastPostId string `json:"last_post_id"`
|
||||
LastPostUpdateID string `json:"last_post_id"`
|
||||
LastPostCreateAt int64 `json:"last_post_create_at"`
|
||||
LastPostCreateID string `json:"last_post_create_id"`
|
||||
}
|
||||
|
||||
func (sc *SharedChannelRemote) IsValid() *AppError {
|
||||
@@ -248,3 +251,49 @@ type SharedChannelRemoteFilterOpts struct {
|
||||
RemoteId string
|
||||
InclUnconfirmed bool
|
||||
}
|
||||
|
||||
// SyncMsg represents a change in content (post add/edit/delete, reaction add/remove, users).
|
||||
// It is sent to remote clusters as the payload of a `RemoteClusterMsg`.
|
||||
type SyncMsg struct {
|
||||
Id string `json:"id"`
|
||||
ChannelId string `json:"channel_id"`
|
||||
Users map[string]*User `json:"users,omitempty"`
|
||||
Posts []*Post `json:"posts,omitempty"`
|
||||
Reactions []*Reaction `json:"reactions,omitempty"`
|
||||
}
|
||||
|
||||
func NewSyncMsg(channelID string) *SyncMsg {
|
||||
return &SyncMsg{
|
||||
Id: NewId(),
|
||||
ChannelId: channelID,
|
||||
}
|
||||
}
|
||||
|
||||
func (sm *SyncMsg) ToJSON() ([]byte, error) {
|
||||
b, err := json.Marshal(sm)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (sm *SyncMsg) String() string {
|
||||
json, err := sm.ToJSON()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return string(json)
|
||||
}
|
||||
|
||||
// SyncResponse represents the response to a synchronization event
|
||||
type SyncResponse struct {
|
||||
UsersLastUpdateAt int64 `json:"users_last_update_at"`
|
||||
UserErrors []string `json:"user_errors"`
|
||||
UsersSyncd []string `json:"users_syncd"`
|
||||
|
||||
PostsLastUpdateAt int64 `json:"posts_last_update_at"`
|
||||
PostErrors []string `json:"post_errors"`
|
||||
|
||||
ReactionsLastUpdateAt int64 `json:"reactions_last_update_at"`
|
||||
ReactionErrors []string `json:"reaction_errors"`
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user