diff --git a/bubble-server/src/main/java/bubble/notify/NotificationHandler_sync_account.java b/bubble-server/src/main/java/bubble/notify/NotificationHandler_sync_account.java index 4b352f5a..aa5c006b 100644 --- a/bubble-server/src/main/java/bubble/notify/NotificationHandler_sync_account.java +++ b/bubble-server/src/main/java/bubble/notify/NotificationHandler_sync_account.java @@ -62,6 +62,7 @@ public class NotificationHandler_sync_account extends ReceivedNotificationHandle return; } localPolicy.update(incomingPolicy); + localPolicy.setAccountContactsJson(incomingPolicy.getAccountContactsJson()); localPolicy.setSkipSync(configuration.getThisNetwork().getInstallType() == AnsibleInstallType.node); accountPolicyDAO.update(localPolicy); } diff --git a/bubble-server/src/main/java/bubble/service/account/SyncAccountNotification.java b/bubble-server/src/main/java/bubble/service/account/SyncAccountNotification.java index b4fa9270..95b65478 100644 --- a/bubble-server/src/main/java/bubble/service/account/SyncAccountNotification.java +++ b/bubble-server/src/main/java/bubble/service/account/SyncAccountNotification.java @@ -5,15 +5,35 @@ package bubble.service.account; import bubble.model.account.AccountPolicy; -import lombok.AllArgsConstructor; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.NonNull; import lombok.Setter; import lombok.experimental.Accessors; -@AllArgsConstructor @NoArgsConstructor @Accessors(chain=true) +import static org.cobbzilla.util.reflect.ReflectionUtil.copy; + +@NoArgsConstructor @Accessors(chain=true) public class SyncAccountNotification { @Getter @Setter private String accountUuid; @Getter @Setter private String updatedHashedPassword; - @Getter @Setter private AccountPolicy updatedPolicy; + @Getter @Setter private AccountPolicyIncludingJSONContacts updatedPolicy; + + public SyncAccountNotification(String accountUuid, String updatedHashedPassword, AccountPolicy updatedPolicy) { + this.accountUuid = accountUuid; + this.updatedHashedPassword = updatedHashedPassword; + if (updatedPolicy != null) { + this.updatedPolicy = new AccountPolicyIncludingJSONContacts(updatedPolicy); + } + } + + @NoArgsConstructor + public class AccountPolicyIncludingJSONContacts extends AccountPolicy { + public AccountPolicyIncludingJSONContacts(@NonNull final AccountPolicy policy) { copy(this, policy); } + + @Override @JsonIgnore(false) @JsonProperty + public String getAccountContactsJson() { return super.getAccountContactsJson(); } + } }