Skip to content

Commit

Permalink
bridgev2/config: add option to disable tag bridging
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Nov 8, 2024
1 parent 22a4c50 commit 702a0e0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions bridgev2/bridgeconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type BridgeConfig struct {
ResendBridgeInfo bool `yaml:"resend_bridge_info"`
BridgeMatrixLeave bool `yaml:"bridge_matrix_leave"`
TagOnlyOnCreate bool `yaml:"tag_only_on_create"`
EnableTagBridging bool `yaml:"enable_tag_bridging"`
MuteOnlyOnCreate bool `yaml:"mute_only_on_create"`
OutgoingMessageReID bool `yaml:"outgoing_message_re_id"`
CleanupOnLogout CleanupOnLogouts `yaml:"cleanup_on_logout"`
Expand Down
1 change: 1 addition & 0 deletions bridgev2/bridgeconfig/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func doUpgrade(helper up.Helper) {
helper.Copy(up.Bool, "bridge", "resend_bridge_info")
helper.Copy(up.Bool, "bridge", "bridge_matrix_leave")
helper.Copy(up.Bool, "bridge", "tag_only_on_create")
helper.Copy(up.Bool, "bridge", "enable_tag_bridging")
helper.Copy(up.Bool, "bridge", "mute_only_on_create")
helper.Copy(up.Bool, "bridge", "cleanup_on_logout", "enabled")
helper.Copy(up.Str, "bridge", "cleanup_on_logout", "manual", "private")
Expand Down
2 changes: 2 additions & 0 deletions bridgev2/matrix/mxmain/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ bridge:
# Should room tags only be synced when creating the portal? Tags mean things like favorite/pin and archive/low priority.
# Tags currently can't be synced back to the remote network, so a continuous sync means tagging from Matrix will be undone.
tag_only_on_create: true
# Should room tags be synced at all?
enable_tag_bridging: true
# Should room mute status only be synced when creating the portal?
# Like tags, mutes can't currently be synced back to the remote network.
mute_only_on_create: true
Expand Down
2 changes: 1 addition & 1 deletion bridgev2/portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3269,7 +3269,7 @@ func (portal *Portal) updateUserLocalInfo(ctx context.Context, info *UserLocalPo
zerolog.Ctx(ctx).Err(err).Msg("Failed to mute room")
}
}
if info.Tag != nil && (didJustCreate || !portal.Bridge.Config.TagOnlyOnCreate) && (!didJustCreate || *info.Tag != "") {
if info.Tag != nil && portal.Bridge.Config.EnableTagBridging && (didJustCreate || !portal.Bridge.Config.TagOnlyOnCreate) && (!didJustCreate || *info.Tag != "") {
err := dp.TagRoom(ctx, portal.MXID, *info.Tag, *info.Tag != "")
if err != nil {
zerolog.Ctx(ctx).Err(err).Msg("Failed to tag room")
Expand Down

0 comments on commit 702a0e0

Please sign in to comment.