Adds status sync to shared channels (#28020)

* Adds status sync to shared channels

To allow for status to be synced, this changes add a new type of
shared channel internal task. This task has its contents pre-fetched
and stored in the `existingMsg` property, and it is keyed with a user
ID besides a channel ID, so it doesn't conflict with channel-driven
synchronization tasks.

All status synchronizations are triggered from the app layer, so there
is no need of watching for new WebSocket events. Although right now
we're only syncing one user status per message, the changes account
for a list of statuses in case we want to batch them in the future.

The feature is gated by a configuration property and can be disabled
independently of the rest of Shared Channels if it's necessary. It is
backwards compatible as well, and should cause no problems with
servers running older Mattermost versions.

* Adds status sync error management and retry

* Adds DisableSharedChannelsStatusSync to the telemetry report

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Miguel de la Cruz
2024-09-10 23:39:07 +02:00
коммит произвёл GitHub
родитель c74f830b76
Коммит b898d13e55
15 изменённых файлов: 240 добавлений и 36 удалений

Просмотреть файл

@@ -3243,8 +3243,9 @@ func (w *WranglerSettings) IsValid() *AppError {
}
type ConnectedWorkspacesSettings struct {
EnableSharedChannels *bool
EnableRemoteClusterService *bool
EnableSharedChannels *bool
EnableRemoteClusterService *bool
DisableSharedChannelsStatusSync *bool
}
func (c *ConnectedWorkspacesSettings) SetDefaults(isUpdate bool, e ExperimentalSettings) {
@@ -3263,6 +3264,10 @@ func (c *ConnectedWorkspacesSettings) SetDefaults(isUpdate bool, e ExperimentalS
c.EnableRemoteClusterService = NewPointer(false)
}
}
if c.DisableSharedChannelsStatusSync == nil {
c.DisableSharedChannelsStatusSync = NewPointer(false)
}
}
type GlobalRelayMessageExportSettings struct {

Просмотреть файл

@@ -275,6 +275,7 @@ type SyncMsg struct {
Users map[string]*User `json:"users,omitempty"`
Posts []*Post `json:"posts,omitempty"`
Reactions []*Reaction `json:"reactions,omitempty"`
Statuses []*Status `json:"statuses,omitempty"`
}
func NewSyncMsg(channelID string) *SyncMsg {
@@ -311,6 +312,8 @@ type SyncResponse struct {
ReactionsLastUpdateAt int64 `json:"reactions_last_update_at"`
ReactionErrors []string `json:"reaction_errors"`
StatusErrors []string `json:"status_errors"` // user IDs for which the status sync failed
}
// RegisterPluginOpts is passed by plugins to the `RegisterPluginForSharedChannels` plugin API