fix privacy friend verification updates

This commit is contained in:
richjohnrambo
2026-10-14 17:11:41 +08:00
parent 297f1fa0b7
commit 441009b81c
2 changed files with 15 additions and 1 deletions
+14
View File
@@ -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")
}
}
+1 -1
View File
@@ -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 {