Plugin API hook for Shared Channel file attachment sync (#25874)

* option for auto inviting plugin to all shared channels.

* auto-invite remotes to shared channels when flag set

* fix unit test

* immediately ping new remotes; fix unique siteurl bug

* make i18n-extract

* fix translations

* plugin hooks for file attachments

* hook for profile image sync

* fix profile image sync

* fix unit test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Doug Lauder
2024-01-16 09:48:51 -05:00
коммит произвёл GitHub
родитель d90d3e4036
Коммит a07097ed57
21 изменённых файлов: 461 добавлений и 76 удалений

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

@@ -1052,6 +1052,79 @@ func (s *hooksRPCServer) PreferencesHaveChanged(args *Z_PreferencesHaveChangedAr
return nil
}
func init() {
hookNameToId["OnSharedChannelsAttachmentSyncMsg"] = OnSharedChannelsAttachmentSyncMsgID
}
type Z_OnSharedChannelsAttachmentSyncMsgArgs struct {
A *model.FileInfo
B *model.Post
C *model.RemoteCluster
}
type Z_OnSharedChannelsAttachmentSyncMsgReturns struct {
A error
}
func (g *hooksRPCClient) OnSharedChannelsAttachmentSyncMsg(fi *model.FileInfo, post *model.Post, rc *model.RemoteCluster) error {
_args := &Z_OnSharedChannelsAttachmentSyncMsgArgs{fi, post, rc}
_returns := &Z_OnSharedChannelsAttachmentSyncMsgReturns{}
if g.implemented[OnSharedChannelsAttachmentSyncMsgID] {
if err := g.client.Call("Plugin.OnSharedChannelsAttachmentSyncMsg", _args, _returns); err != nil {
g.log.Error("RPC call OnSharedChannelsAttachmentSyncMsg to plugin failed.", mlog.Err(err))
}
}
return _returns.A
}
func (s *hooksRPCServer) OnSharedChannelsAttachmentSyncMsg(args *Z_OnSharedChannelsAttachmentSyncMsgArgs, returns *Z_OnSharedChannelsAttachmentSyncMsgReturns) error {
if hook, ok := s.impl.(interface {
OnSharedChannelsAttachmentSyncMsg(fi *model.FileInfo, post *model.Post, rc *model.RemoteCluster) error
}); ok {
returns.A = hook.OnSharedChannelsAttachmentSyncMsg(args.A, args.B, args.C)
returns.A = encodableError(returns.A)
} else {
return encodableError(fmt.Errorf("Hook OnSharedChannelsAttachmentSyncMsg called but not implemented."))
}
return nil
}
func init() {
hookNameToId["OnSharedChannelsProfileImageSyncMsg"] = OnSharedChannelsProfileImageSyncMsgID
}
type Z_OnSharedChannelsProfileImageSyncMsgArgs struct {
A *model.User
B *model.RemoteCluster
}
type Z_OnSharedChannelsProfileImageSyncMsgReturns struct {
A error
}
func (g *hooksRPCClient) OnSharedChannelsProfileImageSyncMsg(user *model.User, rc *model.RemoteCluster) error {
_args := &Z_OnSharedChannelsProfileImageSyncMsgArgs{user, rc}
_returns := &Z_OnSharedChannelsProfileImageSyncMsgReturns{}
if g.implemented[OnSharedChannelsProfileImageSyncMsgID] {
if err := g.client.Call("Plugin.OnSharedChannelsProfileImageSyncMsg", _args, _returns); err != nil {
g.log.Error("RPC call OnSharedChannelsProfileImageSyncMsg to plugin failed.", mlog.Err(err))
}
}
return _returns.A
}
func (s *hooksRPCServer) OnSharedChannelsProfileImageSyncMsg(args *Z_OnSharedChannelsProfileImageSyncMsgArgs, returns *Z_OnSharedChannelsProfileImageSyncMsgReturns) error {
if hook, ok := s.impl.(interface {
OnSharedChannelsProfileImageSyncMsg(user *model.User, rc *model.RemoteCluster) error
}); ok {
returns.A = hook.OnSharedChannelsProfileImageSyncMsg(args.A, args.B)
returns.A = encodableError(returns.A)
} else {
return encodableError(fmt.Errorf("Hook OnSharedChannelsProfileImageSyncMsg called but not implemented."))
}
return nil
}
type Z_RegisterCommandArgs struct {
A *model.Command
}