aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-08-04 21:43:48 -0500
committerRobin Jarry <robin@jarry.cc>2022-08-05 21:57:12 +0200
commit6057d156e6abd0b4c309e00c05021213565a2775 (patch)
tree5d23a8903d12b52e35555639a509add63f1f8ee7
parent602a5778e872cf18935433b2916b0e4a54f5fcea (diff)
downloadaerc-6057d156e6abd0b4c309e00c05021213565a2775.tar.gz
delete: revert deleted messages if Delete is unsupported
Delete operations are not supported by the notmuch backend. Revert deleted messages when the operation is not supported, and reselect the original selection. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--commands/msg/delete.go3
-rw-r--r--lib/msgstore.go3
2 files changed, 6 insertions, 0 deletions
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index fdb2117c..ceb570b3 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -42,6 +42,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
if err != nil {
return err
}
+ sel := store.Selected()
// caution, can be nil
next := findNextNonDeleted(uids, store)
store.ClearVisualMark()
@@ -80,9 +81,11 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
}
case *types.Error:
store.Remark()
+ store.Select(sel.Uid)
aerc.PushError(msg.Error.Error())
case *types.Unsupported:
store.Remark()
+ store.Select(sel.Uid)
// notmuch doesn't support it, we want the user to know
aerc.PushError(" error, unsupported for this worker")
}
diff --git a/lib/msgstore.go b/lib/msgstore.go
index efa6f732..9799a996 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -440,6 +440,9 @@ func (store *MessageStore) Delete(uids []uint32,
if _, ok := msg.(*types.Error); ok {
store.revertDeleted(uids)
}
+ if _, ok := msg.(*types.Unsupported); ok {
+ store.revertDeleted(uids)
+ }
cb(msg)
})
}