From a724cdb35b39154273afa2cbc84e3cb9efd3ee18 Mon Sep 17 00:00:00 2001 From: Petyo Stoyanov Date: Wed, 19 Feb 2025 09:40:41 +0200 Subject: [PATCH 1/4] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5c15cad4..f2f1c9440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Fixed +- Fix privacy format [#755](https://github.com/rokwire/core-building-block/issues/755) + ## [1.48.0] - 2025-18-02 ### Changed - Default privacy for new accounts [#752](https://github.com/rokwire/core-building-block/issues/752) From 25b3bf5fc8d960ec5d031be1321341c95d910182 Mon Sep 17 00:00:00 2001 From: Petyo Stoyanov Date: Wed, 19 Feb 2025 09:47:04 +0200 Subject: [PATCH 2/4] Fix default privacy --- driver/web/conversions_user.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/driver/web/conversions_user.go b/driver/web/conversions_user.go index 2f64502df..a59fabfb5 100644 --- a/driver/web/conversions_user.go +++ b/driver/web/conversions_user.go @@ -398,10 +398,12 @@ func privacyFromDefNullable(item *Def.PrivacyNullable) model.Privacy { if item == nil { //default privacy public := true fieldVisibility := map[string]interface{}{ - "first_name": "public", - "last_name": "public", - "middle_name": "public", - "email": "public", + "profile": map[string]interface{}{ + "first_name": "public", + "last_name": "public", + "middle_name": "public", + "email": "public", + }, } return model.Privacy{Public: public, FieldVisibility: fieldVisibility} } From faf87de559c64cf0392357454e7c9fa597937577 Mon Sep 17 00:00:00 2001 From: Petyo Stoyanov Date: Wed, 19 Feb 2025 10:15:52 +0200 Subject: [PATCH 3/4] Use different function --- driver/web/conversions_user.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/driver/web/conversions_user.go b/driver/web/conversions_user.go index a59fabfb5..d76511013 100644 --- a/driver/web/conversions_user.go +++ b/driver/web/conversions_user.go @@ -396,16 +396,7 @@ func privacyFromDef(item *Def.Privacy) model.Privacy { func privacyFromDefNullable(item *Def.PrivacyNullable) model.Privacy { if item == nil { //default privacy - public := true - fieldVisibility := map[string]interface{}{ - "profile": map[string]interface{}{ - "first_name": "public", - "last_name": "public", - "middle_name": "public", - "email": "public", - }, - } - return model.Privacy{Public: public, FieldVisibility: fieldVisibility} + return defaultPrivacy() } var public bool @@ -420,6 +411,20 @@ func privacyFromDefNullable(item *Def.PrivacyNullable) model.Privacy { return model.Privacy{Public: public, FieldVisibility: fieldVisibility} } +func defaultPrivacy() model.Privacy { + return model.Privacy{ + Public: true, + FieldVisibility: map[string]interface{}{ + "profile": map[string]interface{}{ + "first_name": "public", + "last_name": "public", + "middle_name": "public", + "email": "public", + }, + }, + } +} + // MFA func mfaDataListToDef(items []model.MFAType) []Def.SharedResMfa { out := make([]Def.SharedResMfa, len(items)) From 064a6db959167487678f19e66aad1107eb314537 Mon Sep 17 00:00:00 2001 From: Petyo Stoyanov Date: Wed, 19 Feb 2025 10:16:56 +0200 Subject: [PATCH 4/4] Call the function --- driver/web/conversions_user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/web/conversions_user.go b/driver/web/conversions_user.go index d76511013..773f00fda 100644 --- a/driver/web/conversions_user.go +++ b/driver/web/conversions_user.go @@ -379,7 +379,7 @@ func privacyToDef(item *model.Privacy) *Def.Privacy { func privacyFromDef(item *Def.Privacy) model.Privacy { if item == nil { - return model.Privacy{} + return defaultPrivacy() } var public bool