all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
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	[thread overview]
Message-ID: <20260617105617.2351595-1-d.csapak@proxmox.com> (raw)

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 <d.csapak@proxmox.com>
---
 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<Option<(String, MailAction)>, Error> {
+fn extract_mail_info_from_query_param() -> Result<(Option<String>, Option<MailAction>), 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





                 reply	other threads:[~2026-06-17 10:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260617105617.2351595-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal