refactor: standardize bridge-agnostic terminology and remove unused kvstore functions

- Replace "Room" with "Channel" in bridge-agnostic contexts throughout codebase
- Update BridgeRoomID → BridgeChannelID in model structs and all references
- Change error messages to use consistent "Channel" terminology for user-facing text
- Update log keys: bridge_room_id → bridge_channel_id for consistency
- Clean up kvstore constants file by removing unused functions and constants:
  - Removed BuildXMPPUserKey, BuildMattermostUserKey, BuildGhostUserKey
  - Removed BuildXMPPEventPostKey, BuildXMPPReactionKey functions
  - Removed unused constants: KeyPrefixXMPPUser, KeyPrefixMattermostUser, etc.
  - Keep only actively used BuildChannelMapKey and ExtractIdentifierFromChannelMapKey
- Preserve XMPP-specific "Room" terminology in appropriate contexts (client methods, JIDs)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Felipe M 2025-08-05 12:33:19 +02:00
parent eb852662f7
commit 4c6aeb2392
No known key found for this signature in database
GPG key ID: 52E5D65FCF99808A
8 changed files with 94 additions and 150 deletions

View file

@ -20,11 +20,11 @@ const (
// CreateChannelMappingRequest contains information needed to create a channel mapping
type CreateChannelMappingRequest struct {
ChannelID string // Mattermost channel ID
BridgeName string // Name of the bridge (e.g., "xmpp")
BridgeRoomID string // Remote room/channel ID (e.g., JID for XMPP)
UserID string // ID of user who triggered the mapping creation
TeamID string // Team ID where the channel belongs
ChannelID string // Mattermost channel ID
BridgeName string // Name of the bridge (e.g., "xmpp")
BridgeChannelID string // Remote room/channel ID (e.g., JID for XMPP)
UserID string // ID of user who triggered the mapping creation
TeamID string // Team ID where the channel belongs
}
// Validate checks if all required fields are present and valid
@ -35,8 +35,8 @@ func (r CreateChannelMappingRequest) Validate() error {
if r.BridgeName == "" {
return fmt.Errorf("bridgeName cannot be empty")
}
if r.BridgeRoomID == "" {
return fmt.Errorf("bridgeRoomID cannot be empty")
if r.BridgeChannelID == "" {
return fmt.Errorf("bridgeChannelID cannot be empty")
}
if r.UserID == "" {
return fmt.Errorf("userID cannot be empty")
@ -132,13 +132,13 @@ type Bridge interface {
// Stop stops the bridge
Stop() error
// CreateChannelMapping creates a mapping between a Mattermost channel ID and an bridge room ID.
// CreateChannelMapping creates a mapping between a Mattermost channel ID and a bridge channel ID.
CreateChannelMapping(channelID, roomJID string) error
// GetChannelMapping retrieves the bridge room ID for a given Mattermost channel ID.
// GetChannelMapping retrieves the bridge channel ID for a given Mattermost channel ID.
GetChannelMapping(channelID string) (string, error)
// DeleteChannelMapping removes a mapping between a Mattermost channel ID and a bridge room ID.
// DeleteChannelMapping removes a mapping between a Mattermost channel ID and a bridge channel ID.
DeleteChannelMapping(channelID string) error
// ChannelMappingExists checks if a room/channel exists on the remote service.

View file

@ -30,8 +30,8 @@ type BridgeMessage struct {
ThreadID string // Thread/reply ID (if applicable)
// Routing hints
TargetBridges []string // Which bridges should receive this
Metadata map[string]any // Bridge-specific metadata
TargetBridges []string // Which bridges should receive this
Metadata map[string]any // Bridge-specific metadata
}
// DirectionalMessage wraps a BridgeMessage with direction information
@ -85,4 +85,4 @@ type MessageHandler interface {
// GetSupportedMessageTypes returns the message types this handler supports
GetSupportedMessageTypes() []string
}
}