* [PATCH pmg-yew-quarantine-gui] spam list: open mail when given via query parameter
@ 2026-06-17 10:56 Dominik Csapak
2026-06-19 9:34 ` Stoiko Ivanov
0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread
* Re: [PATCH pmg-yew-quarantine-gui] spam list: open mail when given via query parameter
2026-06-17 10:56 [PATCH pmg-yew-quarantine-gui] spam list: open mail when given via query parameter Dominik Csapak
@ 2026-06-19 9:34 ` Stoiko Ivanov
0 siblings, 0 replies; 2+ messages in thread
From: Stoiko Ivanov @ 2026-06-19 9:34 UTC (permalink / raw)
To: Dominik Csapak; +Cc: pmg-devel
Thanks for the patch!
checked it out and gave it a spin - looks fine and works as advertised:
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
FWIW: while there I noticed an error in the browser dev-tools console:
`Could not load acl tree - api error (status = 501: Method 'GET
/access/acl' not implemented`
looked around and saw:
https://git.proxmox.com/?p=ui/proxmox-yew-comp.git;a=commitdiff;h=a9524ba99c93d3eddfbf4a28552b9abfaabfb534
-> verified that the patch fixes the spurious error.
On Wed, 17 Jun 2026 12:56:11 +0200
Dominik Csapak <d.csapak@proxmox.com> wrote:
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-19 9:34 UTC | newest]
Thread overview: 2+ messages (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
2026-06-19 9:34 ` Stoiko Ivanov
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.