aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-03-27 10:24:19 +0100
committerSimon Ser <contact@emersion.fr>2020-03-27 10:24:19 +0100
commit9b804005b445d54114a1ddeb3cb6b22a872911d2 (patch)
tree22dc3cffe0b6e36f9afa0ebfc79a7661eb0ef532 /plugins/base
parentc182fbde6334f07873700d6a487155fb3f493403 (diff)
downloadalps-9b804005b445d54114a1ddeb3cb6b22a872911d2.tar.gz
alps-9b804005b445d54114a1ddeb3cb6b22a872911d2.zip
plugins/base: add redirect param to move/delete/flag endpoints
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/routes.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/base/routes.go b/plugins/base/routes.go
index 0782159..1ea611d 100644
--- a/plugins/base/routes.go
+++ b/plugins/base/routes.go
@@ -696,6 +696,9 @@ func handleMove(ctx *koushin.Context) error {
return err
}
+ if path := ctx.QueryParam("next"); path != "" {
+ return ctx.Redirect(http.StatusFound, path)
+ }
return ctx.Redirect(http.StatusFound, fmt.Sprintf("/mailbox/%v", url.PathEscape(to)))
}
@@ -744,6 +747,9 @@ func handleDelete(ctx *koushin.Context) error {
return err
}
+ if path := ctx.QueryParam("next"); path != "" {
+ return ctx.Redirect(http.StatusFound, path)
+ }
return ctx.Redirect(http.StatusFound, fmt.Sprintf("/mailbox/%v", url.PathEscape(mboxName)))
}
@@ -813,7 +819,10 @@ func handleSetFlags(ctx *koushin.Context) error {
return err
}
- if len(uids) != 1 || (op == imap.RemoveFlags && len(flags) == 1 && flags[0] == "\\Seen") {
+ if path := ctx.QueryParam("next"); path != "" {
+ return ctx.Redirect(http.StatusFound, path)
+ }
+ if len(uids) != 1 || (op == imap.RemoveFlags && len(flags) == 1 && flags[0] == imap.SeenFlag) {
// Redirecting to the message view would mark the message as read again
return ctx.Redirect(http.StatusFound, fmt.Sprintf("/mailbox/%v", url.PathEscape(mboxName)))
}