~migadu/alps-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] gracefully fail when no messages are selected for deletion or moving

Details
Message ID
<20220507081712.6181-1-amk@amk.ie>
DKIM signature
missing
Download raw message
Patch: +10 -0
---
 plugins/base/routes.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/plugins/base/routes.go b/plugins/base/routes.go
index 255faa5..52d1681 100644
--- a/plugins/base/routes.go
+++ b/plugins/base/routes.go
@@ -1024,6 +1024,11 @@ func handleMove(ctx *alps.Context) error {
		return echo.NewHTTPError(http.StatusBadRequest, err)
	}

	if len(uids) == 0 {
		ctx.Session.PutNotice("No messages selected.")
		return ctx.Redirect(http.StatusFound, fmt.Sprintf("/mailbox/%v", url.PathEscape(mboxName)))
	}

	to := formOrQueryParam(ctx, "to")
	if to == "" {
		return echo.NewHTTPError(http.StatusBadRequest, "missing 'to' form parameter")
@@ -1071,6 +1076,11 @@ func handleDelete(ctx *alps.Context) error {
		return echo.NewHTTPError(http.StatusBadRequest, err)
	}

	if len(uids) == 0 {
		ctx.Session.PutNotice("No messages selected.")
		return ctx.Redirect(http.StatusFound, fmt.Sprintf("/mailbox/%v", url.PathEscape(mboxName)))
	}

	err = ctx.Session.DoIMAP(func(c *imapclient.Client) error {
		if err := ensureMailboxSelected(c, mboxName); err != nil {
			return err
-- 
2.36.0
Details
Message ID
<UDv5fZBB1uFn3uTLSvByBkPg8zrJiJqggE_wtyVCYpI6ibG3I6b0BvzhpcLKVcttmu2Ae_AbXg_12TVAq3qBqSqMHCkZm6fV0nalVK7XXSo=@emersion.fr>
In-Reply-To
<20220507081712.6181-1-amk@amk.ie> (view parent)
DKIM signature
missing
Download raw message
Pushed, thanks!
Reply to thread Export thread (mbox)