MM-52600: [Shared Channels] Shared channels do not sync channel membership (#30976)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0082e3e94d
Коммит
fa1c77d9b0
@@ -507,3 +507,15 @@ type GroupMessageConversionRequestBody struct {
|
||||
Name string `json:"name"`
|
||||
DisplayName string `json:"display_name"`
|
||||
}
|
||||
|
||||
// ChannelMembersGetOptions provides parameters for getting channel members
|
||||
type ChannelMembersGetOptions struct {
|
||||
// ChannelID specifies which channel to get members for
|
||||
ChannelID string
|
||||
// Offset for pagination
|
||||
Offset int
|
||||
// Limit for pagination (maximum number of results to return)
|
||||
Limit int
|
||||
// UpdatedAfter filters members updated after the given timestamp (cursor-based pagination)
|
||||
UpdatedAfter int64
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ const (
|
||||
PasswordMaximumLength = 72
|
||||
PasswordMinimumLength = 5
|
||||
|
||||
ServiceGitlab = "gitlab"
|
||||
ServiceGitlab = "gitlab"
|
||||
|
||||
ServiceGoogle = "google"
|
||||
ServiceOffice365 = "office365"
|
||||
ServiceOpenid = "openid"
|
||||
@@ -285,7 +286,8 @@ const (
|
||||
|
||||
LocalModeSocketPath = "/var/tmp/mattermost_local.socket"
|
||||
|
||||
ConnectedWorkspacesSettingsDefaultMaxPostsPerSync = 50 // a bit more than 4 typical screenfulls of posts
|
||||
ConnectedWorkspacesSettingsDefaultMaxPostsPerSync = 50 // a bit more than 4 typical screenfulls of posts
|
||||
ConnectedWorkspacesSettingsDefaultMemberSyncBatchSize = 20 // optimal batch size for syncing channel members
|
||||
|
||||
// These storage classes are the valid values for the x-amz-storage-class header. More documentation here https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#AmazonS3-PutObject-request-header-StorageClass
|
||||
StorageClassStandard = "STANDARD"
|
||||
@@ -3462,6 +3464,7 @@ type ConnectedWorkspacesSettings struct {
|
||||
SyncUsersOnConnectionOpen *bool
|
||||
GlobalUserSyncBatchSize *int
|
||||
MaxPostsPerSync *int
|
||||
MemberSyncBatchSize *int // Maximum number of members to process in a single batch during shared channel synchronization
|
||||
}
|
||||
|
||||
func (c *ConnectedWorkspacesSettings) SetDefaults(isUpdate bool, e ExperimentalSettings) {
|
||||
@@ -3496,6 +3499,10 @@ func (c *ConnectedWorkspacesSettings) SetDefaults(isUpdate bool, e ExperimentalS
|
||||
if c.MaxPostsPerSync == nil {
|
||||
c.MaxPostsPerSync = NewPointer(ConnectedWorkspacesSettingsDefaultMaxPostsPerSync)
|
||||
}
|
||||
|
||||
if c.MemberSyncBatchSize == nil {
|
||||
c.MemberSyncBatchSize = NewPointer(ConnectedWorkspacesSettingsDefaultMemberSyncBatchSize)
|
||||
}
|
||||
}
|
||||
|
||||
type GlobalRelayMessageExportSettings struct {
|
||||
|
||||
@@ -25,6 +25,9 @@ type FeatureFlags struct {
|
||||
// Enable plugins in shared channels.
|
||||
EnableSharedChannelsPlugins bool
|
||||
|
||||
// Enable synchronization of channel members in shared channels
|
||||
EnableSharedChannelsMemberSync bool
|
||||
|
||||
// Enable syncing all users for remote clusters in shared channels
|
||||
EnableSyncAllUsersForRemoteCluster bool
|
||||
|
||||
@@ -72,6 +75,7 @@ func (f *FeatureFlags) SetDefaults() {
|
||||
f.TestBoolFeature = false
|
||||
f.EnableRemoteClusterService = false
|
||||
f.EnableSharedChannelsDMs = false
|
||||
f.EnableSharedChannelsMemberSync = false
|
||||
f.EnableSyncAllUsersForRemoteCluster = false
|
||||
f.EnableSharedChannelsPlugins = true
|
||||
f.AppsEnabled = false
|
||||
|
||||
@@ -118,6 +118,7 @@ type SharedChannelRemote struct {
|
||||
LastPostUpdateID string `json:"last_post_id"`
|
||||
LastPostCreateAt int64 `json:"last_post_create_at"`
|
||||
LastPostCreateID string `json:"last_post_create_id"`
|
||||
LastMembersSyncAt int64 `json:"last_members_sync_at"`
|
||||
}
|
||||
|
||||
func (sc *SharedChannelRemote) IsValid() *AppError {
|
||||
@@ -169,12 +170,13 @@ type SharedChannelRemoteStatus struct {
|
||||
// SharedChannelUser stores a lastSyncAt timestamp on behalf of a remote cluster for
|
||||
// each user that has been synchronized.
|
||||
type SharedChannelUser struct {
|
||||
Id string `json:"id"`
|
||||
UserId string `json:"user_id"`
|
||||
ChannelId string `json:"channel_id"`
|
||||
RemoteId string `json:"remote_id"`
|
||||
CreateAt int64 `json:"create_at"`
|
||||
LastSyncAt int64 `json:"last_sync_at"`
|
||||
Id string `json:"id"`
|
||||
UserId string `json:"user_id"`
|
||||
ChannelId string `json:"channel_id"`
|
||||
RemoteId string `json:"remote_id"`
|
||||
CreateAt int64 `json:"create_at"`
|
||||
LastSyncAt int64 `json:"last_sync_at"`
|
||||
LastMembershipSyncAt int64 `json:"last_membership_sync_at"`
|
||||
}
|
||||
|
||||
func (scu *SharedChannelUser) PreSave() {
|
||||
@@ -270,15 +272,25 @@ type SharedChannelRemoteFilterOpts struct {
|
||||
IncludeDeleted bool
|
||||
}
|
||||
|
||||
// MembershipChangeMsg represents a change in channel membership
|
||||
type MembershipChangeMsg struct {
|
||||
ChannelId string `json:"channel_id"`
|
||||
UserId string `json:"user_id"`
|
||||
IsAdd bool `json:"is_add"`
|
||||
RemoteId string `json:"remote_id"`
|
||||
ChangeTime int64 `json:"change_time"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
Statuses []*Status `json:"statuses,omitempty"`
|
||||
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"`
|
||||
Statuses []*Status `json:"statuses,omitempty"`
|
||||
MembershipChanges []*MembershipChangeMsg `json:"membership_changes,omitempty"`
|
||||
}
|
||||
|
||||
func NewSyncMsg(channelID string) *SyncMsg {
|
||||
|
||||
Ссылка в новой задаче
Block a user