From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 8E36B1FF13B for ; Wed, 25 Mar 2026 13:15:33 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DFBFD16B67; Wed, 25 Mar 2026 13:15:54 +0100 (CET) From: Shannon Sterz To: yew-devel@lists.proxmox.com Subject: [PATCH yew-comp] user panel: handle expire property on edit properly Date: Wed, 25 Mar 2026 13:15:16 +0100 Message-ID: <20260325121516.164312-1-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774440872676 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.121 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 56YVWSFRKBFUCATJEIJ2YZGQ333WHXKY X-Message-ID-Hash: 56YVWSFRKBFUCATJEIJ2YZGQ333WHXKY X-MailFrom: s.sterz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Yew framework devel list at Proxmox List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: setting expire to "0" is a special case meaning "never expires". while this was honored in the user management overview, the edit panel rendered this as 01.01.1970 00:00:00 UTC, or the Unix epoch. this had minimal functional impact, but it may be confusing to users. set expire to `Value::Null` in this special case, rendering a cleared date picker. also the expire field is typically an `Option` [1]. so instead of interpreting it as a `f64` and then casting it back to an `i64` when rendering the input date, interpret it as an `i64` straight away. [1]: https://git.proxmox.com/?p=proxmox.git;a=blob;f=proxmox-access-control/src/types.rs;h=78eafb4c9d1e652f4d69c203aa2117cfe65544c2;hb=HEAD#l218 Signed-off-by: Shannon Sterz --- src/user_panel.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/user_panel.rs b/src/user_panel.rs index 547fdfe..75a442f 100644 --- a/src/user_panel.rs +++ b/src/user_panel.rs @@ -40,8 +40,12 @@ async fn load_user(userid: Key) -> Result, Error> { let mut resp: ApiResponseData = crate::http_get_full(&url, None).await?; if let Value::Number(number) = &resp.data["expire"] { - if let Some(epoch) = number.as_f64() { - resp.data["expire"] = Value::String(epoch_to_input_value(epoch as i64)); + if let Some(epoch) = number.as_i64() { + if epoch == 0 { + resp.data["expire"] = Value::Null; + } else { + resp.data["expire"] = Value::String(epoch_to_input_value(epoch)); + } } } -- 2.47.3