From e65fbbfc2105566a3c457dd34d3ae790ce7f4fb5 Mon Sep 17 00:00:00 2001 From: Stefan Melmuk Date: Wed, 1 Feb 2023 23:10:09 +0100 Subject: [PATCH] don't nullify key when editing emergency access the client does not send the key on every update of an emergency access contact so the field would be emptied on a change of the wait days or access level. --- src/api/core/emergency_access.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/core/emergency_access.rs b/src/api/core/emergency_access.rs index fcabc617..90a5e6b8 100644 --- a/src/api/core/emergency_access.rs +++ b/src/api/core/emergency_access.rs @@ -123,7 +123,9 @@ async fn post_emergency_access( emergency_access.atype = new_type; emergency_access.wait_time_days = data.WaitTimeDays; - emergency_access.key_encrypted = data.KeyEncrypted; + if data.KeyEncrypted.is_some() { + emergency_access.key_encrypted = data.KeyEncrypted; + } emergency_access.save(&mut conn).await?; Ok(Json(emergency_access.to_json()))