Преглед на файлове

Add option to disable bridging Matrix leave events

Tulir Asokan преди 4 години
родител
ревизия
9f4283b4e0
променени са 3 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 2 0
      config/bridge.go
  2. 2 0
      example-config.yaml
  3. 1 1
      portal.go

+ 2 - 0
config/bridge.go

@@ -60,6 +60,7 @@ type BridgeConfig struct {
 	RecoverHistory       bool   `yaml:"recovery_history_backfill"`
 	ChatMetaSync         bool   `yaml:"chat_meta_sync"`
 	UserAvatarSync       bool   `yaml:"user_avatar_sync"`
+	BridgeMatrixLeave    bool   `yaml:"bridge_matrix_leave"`
 	SyncChatMaxAge       uint64 `yaml:"sync_max_chat_age"`
 
 	SyncWithCustomPuppets bool   `yaml:"sync_with_custom_puppets"`
@@ -120,6 +121,7 @@ func (bc *BridgeConfig) setDefaults() {
 	bc.RecoverHistory = true
 	bc.ChatMetaSync = true
 	bc.UserAvatarSync = true
+	bc.BridgeMatrixLeave = true
 	bc.SyncChatMaxAge = 259200
 
 	bc.SyncWithCustomPuppets = true

+ 2 - 0
example-config.yaml

@@ -141,6 +141,8 @@ bridge:
     # Whether or not puppet avatars should be fetched from the server even if an avatar is already set.
     # If you get 599 errors often, you should try disabling this.
     user_avatar_sync: true
+    # Whether or not Matrix users leaving groups should be bridged to WhatsApp
+    bridge_matrix_leave: true
     # Maximum number of seconds since last message in chat to skip
     # syncing the chat in any case. This setting will take priority
     # over both recovery_chat_sync_limit and initial_chat_sync_count.

+ 1 - 1
portal.go

@@ -2271,7 +2271,7 @@ func (portal *Portal) HandleMatrixLeave(sender *User) {
 		portal.Delete()
 		portal.Cleanup(false)
 		return
-	} else {
+	} else if portal.bridge.Config.Bridge.BridgeMatrixLeave {
 		// TODO should we somehow deduplicate this call if this leave was sent by the bridge?
 		resp, err := sender.Conn.LeaveGroup(portal.Key.JID)
 		if err != nil {