From 26b9c3d9665db0d5a7990f75fc1baccc0139e7a5 Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Tue, 26 Jul 2022 13:48:27 +0200 Subject: sort: show warning when sort is not supported Use the capabilities returned by the backend to check whether sort is implemented when the user tries to use the sort command. Print a warning to the log when a sort request is silently dropped by the backend. Suggested-by: |cos| Signed-off-by: Koni Marti Acked-by: Robin Jarry --- commands/account/sort.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'commands') diff --git a/commands/account/sort.go b/commands/account/sort.go index e9ee4a34..f8cb94c1 100644 --- a/commands/account/sort.go +++ b/commands/account/sort.go @@ -72,6 +72,12 @@ func (Sort) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("Messages still loading.") } + if c := store.Capabilities(); c != nil { + if !c.Sort { + return errors.New("Sorting is not available for this backend.") + } + } + var err error var sortCriteria []*types.SortCriterion if len(args[1:]) == 0 { -- cgit