* [PATCH pmg-yew-quarantine-gui] spam list: open mail when given via query parameter
@ 2026-06-17 10:56 Dominik Csapak
0 siblings, 0 replies; only message in thread
From: Dominik Csapak @ 2026-06-17 10:56 UTC (permalink / raw)
To: pmg-devel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-17 10:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 10:56 [PATCH pmg-yew-quarantine-gui] spam list: open mail when given via query parameter Dominik Csapak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox