Shared channels plugin APIs for MS Teams plugin (#25805)

New plugin APIs and hooks for accessing Shared Channels service via plugin. 

- RegisterPluginForSharedChannels(opts model.RegisterPluginOpts) (remoteID string, err error)
- UnregisterPluginForSharedChannels(pluginID string) error
- ShareChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
- UpdateSharedChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
- UnshareChannel(channelID string) (unshared bool, err error)
- UpdateSharedChannelCursor(channelID, remoteID string, cusror model.GetPostsSinceForSyncCursor) error
- SyncSharedChannel(channelID string) error
- InviteRemoteToChannel(channelID string, remoteID string, userID string) error
- UninviteRemoteFromChannel(channelID string, remoteID string) error

Hooks
- OnSharedChannelsSyncMsg(msg *model.SyncMsg, rc *model.RemoteCluster) (model.SyncResponse, error)
- OnSharedChannelsPing(rc *model.RemoteCluster) bool
Этот коммит содержится в:
Doug Lauder
2023-12-22 17:00:27 -05:00
коммит произвёл GitHub
родитель 0f3553c8ab
Коммит 2d1135ca46
40 изменённых файлов: 1725 добавлений и 168 удалений

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

@@ -63,6 +63,7 @@ type AppIface interface {
GetProfileImage(user *model.User) ([]byte, bool, *model.AppError)
InvalidateCacheForUser(userID string)
NotifySharedChannelUserUpdate(user *model.User)
OnSharedChannelsSyncMsg(msg *model.SyncMsg, rc *model.RemoteCluster) (model.SyncResponse, error)
}
// errNotFound allows checking against Store.ErrNotFound errors without making Store a dependency.
@@ -108,7 +109,7 @@ func NewSharedChannelService(server ServerIface, app AppIface) (*Service, error)
// Start is called by the server on server start-up.
func (scs *Service) Start() error {
rcs := scs.server.GetRemoteClusterService()
if rcs == nil {
if rcs == nil || !rcs.Active() {
return errors.New("Shared Channel Service cannot activate: requires Remote Cluster Service")
}
@@ -128,7 +129,7 @@ func (scs *Service) Start() error {
// Shutdown is called by the server on server shutdown.
func (scs *Service) Shutdown() error {
rcs := scs.server.GetRemoteClusterService()
if rcs == nil {
if rcs == nil || !rcs.Active() {
return errors.New("Shared Channel Service cannot shutdown: requires Remote Cluster Service")
}