From 441009b81c4267c20f9fac215bd3cdc5395f9da7 Mon Sep 17 00:00:00 2001 From: richjohnrambo Date: Wed, 14 Oct 2026 17:11:05 +0800 Subject: [PATCH] fix privacy friend verification updates --- server/store/privacy_test.go | 14 ++++++++++++++ server/store/store.go | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 server/store/privacy_test.go diff --git a/server/store/privacy_test.go b/server/store/privacy_test.go new file mode 100644 index 0000000..ce53821 --- /dev/null +++ b/server/store/privacy_test.go @@ -0,0 +1,14 @@ +package store + +import ( + "testing" + + "github.com/tinode/chat/server/store/types" +) + +func TestValidUserPrivacyPatchAcceptsFriendVerificationOnly(t *testing.T) { + disabled := false + if !validUserPrivacyPatch(types.UserPrivacyPatch{FriendRequestVerification: &disabled}) { + t.Fatal("friend_request_verification should be a valid standalone privacy patch") + } +} diff --git a/server/store/store.go b/server/store/store.go index 840e7f9..1701db2 100644 --- a/server/store/store.go +++ b/server/store/store.go @@ -2996,7 +2996,7 @@ func (profileMapper) UpdatePrivacy(tenantID types.TenantID, uid types.Uid, patch } func validUserPrivacyPatch(patch types.UserPrivacyPatch) bool { - if patch.AddMeMethods == nil && patch.ProfileVisibility == nil && patch.LastSeenVisibility == nil && patch.ReadReceipts == nil && patch.GroupInviteVerification == nil { + if patch.AddMeMethods == nil && patch.ProfileVisibility == nil && patch.LastSeenVisibility == nil && patch.ReadReceipts == nil && patch.FriendRequestVerification == nil && patch.GroupInviteVerification == nil { return false } for method := range patch.AddMeMethods {