feat: implement sync and sync-reset commands for shared channel management
- Add GetRemoteID() method to Bridge interface for cursor operations - Update bridge constructors to accept and store remoteID parameter - Implement executeSyncCommand handler for forcing shared channel sync - Implement executeSyncResetCommand handler for resetting sync cursor - Add command registration for 'sync' and 'sync-reset' subcommands - Enhance command handler with direct plugin API access for shared channel operations - Add comprehensive validation and error handling for unmapped channels - Support both SyncSharedChannel and UpdateSharedChannelCursor API methods 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5d81ca2154
commit
d21dcd2dd1
5 changed files with 139 additions and 6 deletions
|
@ -26,6 +26,7 @@ type mattermostBridge struct {
|
|||
kvstore kvstore.KVStore
|
||||
userManager pluginModel.BridgeUserManager
|
||||
botUserID string // Bot user ID for posting messages
|
||||
remoteID string // Remote ID for shared channels
|
||||
|
||||
// Message handling
|
||||
messageHandler *mattermostMessageHandler
|
||||
|
@ -47,13 +48,14 @@ type mattermostBridge struct {
|
|||
}
|
||||
|
||||
// NewBridge creates a new Mattermost bridge
|
||||
func NewBridge(log logger.Logger, api plugin.API, kvstore kvstore.KVStore, cfg *config.Configuration, botUserID string) pluginModel.Bridge {
|
||||
func NewBridge(log logger.Logger, api plugin.API, kvstore kvstore.KVStore, cfg *config.Configuration, botUserID, remoteID string) pluginModel.Bridge {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
b := &mattermostBridge{
|
||||
logger: log,
|
||||
api: api,
|
||||
kvstore: kvstore,
|
||||
botUserID: botUserID,
|
||||
remoteID: remoteID,
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
channelMappings: make(map[string]string),
|
||||
|
@ -395,3 +397,8 @@ func (b *mattermostBridge) GetMessageHandler() pluginModel.MessageHandler {
|
|||
func (b *mattermostBridge) GetUserResolver() pluginModel.UserResolver {
|
||||
return b.userResolver
|
||||
}
|
||||
|
||||
// GetRemoteID returns the remote ID used for shared channels registration
|
||||
func (b *mattermostBridge) GetRemoteID() string {
|
||||
return b.remoteID
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue