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>
This commit is contained in:
parent
602a5778e8
commit
6057d156e6
2 changed files with 6 additions and 0 deletions
|
@ -42,6 +42,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
sel := store.Selected()
|
||||||
// caution, can be nil
|
// caution, can be nil
|
||||||
next := findNextNonDeleted(uids, store)
|
next := findNextNonDeleted(uids, store)
|
||||||
store.ClearVisualMark()
|
store.ClearVisualMark()
|
||||||
|
@ -80,9 +81,11 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}
|
}
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
store.Remark()
|
store.Remark()
|
||||||
|
store.Select(sel.Uid)
|
||||||
aerc.PushError(msg.Error.Error())
|
aerc.PushError(msg.Error.Error())
|
||||||
case *types.Unsupported:
|
case *types.Unsupported:
|
||||||
store.Remark()
|
store.Remark()
|
||||||
|
store.Select(sel.Uid)
|
||||||
// notmuch doesn't support it, we want the user to know
|
// notmuch doesn't support it, we want the user to know
|
||||||
aerc.PushError(" error, unsupported for this worker")
|
aerc.PushError(" error, unsupported for this worker")
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,6 +440,9 @@ func (store *MessageStore) Delete(uids []uint32,
|
||||||
if _, ok := msg.(*types.Error); ok {
|
if _, ok := msg.(*types.Error); ok {
|
||||||
store.revertDeleted(uids)
|
store.revertDeleted(uids)
|
||||||
}
|
}
|
||||||
|
if _, ok := msg.(*types.Unsupported); ok {
|
||||||
|
store.revertDeleted(uids)
|
||||||
|
}
|
||||||
cb(msg)
|
cb(msg)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue