From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 6B37A1FF14F for ; Wed, 17 Jun 2026 12:56:21 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 421D51EC8B; Wed, 17 Jun 2026 12:56:21 +0200 (CEST) From: Dominik Csapak To: pmg-devel@lists.proxmox.com Subject: [PATCH pmg-yew-quarantine-gui] spam list: open mail when given via query parameter Date: Wed, 17 Jun 2026 12:56:11 +0200 Message-ID: <20260617105617.2351595-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.049 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Message-ID-Hash: UVIKGDQERBC3ADU7HZEUHZWSLWQNPTPH X-Message-ID-Hash: UVIKGDQERBC3ADU7HZEUHZWSLWQNPTPH X-MailFrom: d.csapak@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: Proxmox Mail Gateway development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In the quarantine summary e-mail, there are links for the actions of mails but also a link that should just open the specific mail in the quarantine interface without an action. In the mobile UI, only the action was actually implemented, but not the opening when no action was selected. Implement that by handling id and action separately while extracting and calling the 'on_preview' callback in case no action was present. Reported in the forums: https://forum.proxmox.com/threads/174685/#post-857716 Signed-off-by: Dominik Csapak --- src/spam_list.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/spam_list.rs b/src/spam_list.rs index 95a0611..cd4365a 100644 --- a/src/spam_list.rs +++ b/src/spam_list.rs @@ -144,10 +144,14 @@ impl Component for PmgSpamList { _reload_observer: reload_observer, }; - match extract_mail_action_from_query_params() { - Ok(None) => {} - Ok(Some((id, action))) => { - ctx.link().send_message(Msg::Action(id, action)); + match extract_mail_info_from_query_param() { + Ok((None, _)) => {} + Ok((Some(id), action)) => { + if let Some(action) = action { + ctx.link().send_message(Msg::Action(id, action)); + } else if let Some(on_preview) = &ctx.props().on_preview { + on_preview.emit(id.clone()) + } } Err(err) => { ctx.link().show_snackbar( @@ -358,15 +362,16 @@ fn epoch_to_date(epoch: i64) -> String { ) } -fn extract_mail_action_from_query_params() -> Result, Error> { +fn extract_mail_info_from_query_param() -> Result<(Option, Option), Error> { let id = extract_query_parameter("cselect")?; let action = extract_query_parameter("action")?; - if let (Some(id), Some(action)) = (id, action) { - let action = MailAction::from_str(&action)?; - return Ok(Some((id, action))); - } - Ok(None) + let action = match action { + Some(action) => Some(MailAction::from_str(&action)?), + None => None, + }; + + Ok((id, action)) } /// Removes `name` parameter from the get values via the browser `history` object and returns it -- 2.47.3