purebred-mua / purebred

A terminal based mail user agent based on notmuch
GNU Affero General Public License v3.0
139 stars 19 forks source link

Feature/5 marking for bulk actions #380

Closed romanofski closed 4 years ago

romanofski commented 4 years ago

Oof this has now become quite large, but worth it I guess. I'm anticipating that you might not have the time instantly to go through all of that. The way how currently toggled list items are rendered sucks a bit and I may investigate further if that can be improved. However I feel fine to merge it as it is.

commit a15e987b45c7c74e5dacde5bb6067047e9789e19
Author: Róman Joost <roman@bromeco.de>
Date:   Sun Mar 29 15:42:40 2020 +1000

    Re-use HasToggleablelist functions instead of utils

    This is a small refactoring to re-use the HasToggleablelist functions
    instead of the utility functions only used for the file browser. This
    doesn't make the attachment creation generic, since all of this code is
    verys specific to the file browser anyways.

commit 6182328255718612f45b8ac90bf3d181d6018722
Author: Róman Joost <roman@bromeco.de>
Date:   Sun Mar 29 12:24:09 2020 +1000

    Test bulk actions with additional acceptance tests

commit 30fa4a15095eebc8be756a8ca3285a2d2ed5feb8
Author: Róman Joost <roman@bromeco.de>
Date:   Sun Mar 29 07:20:21 2020 +1000

    Use a better word than "Tagged"

    I had used "Tag", because mutt is using "Tag". The word tagging here has
    a different context however. In mutt it used to be to perform bulk
    actions on the tagged list items, but with the introduction of notmuch,
    tagging can also mean the labeling of mails with "tags".

    Instead of using "Tagged", use the word "Marked" since we're marking
    these list items for further action.

commit 43de3888192cedb6a4913e87594bc902d95e3998
Author: Róman Joost <roman@bromeco.de>
Date:   Sat Mar 28 16:47:43 2020 +1000

    Operate on toggled *or* selected list items

    This adds an additional helper for lists supporting toggling of it's
    items. It is similar in nature to our existing `selectedItemHelper`.

    It really is a workaround for Brick's List, since it can not encapsulate
    a marked/toggled state for it's list items. This function allows to
    operate on toggled or selected items.

commit 5e14cb4d43aad4fe705b934da33d873e6d26d097
Author: Róman Joost <roman@bromeco.de>
Date:   Sat Mar 28 16:29:04 2020 +1000

    Use `toggle` to indicate a selected state

    We currently use selected and toggled ambiguosly in the code. To make it
    clear: refer to a list item which is toggled for batch editing as
    `toggled` and a list item which is selected by the cursor as: selected.

commit 3702b535a5fed8dc79baa3986ce7d1050d0a54b9
Author: Róman Joost <roman@bromeco.de>
Date:   Sat Mar 28 10:34:19 2020 +1000

    Raise an error if setTags is called on unsupported widget

    If we call `setTags` on a widget we have not registered a handler for,
    Purebred would simply assume that the only widget would be the list of
    threads.

    However when adding new widgets, this can lead to confusing
    behaviour for new contributors since the handler is silently operating
    on the list of threads.

commit 68b2cf2f01356e0cc0c231adabb2a4dd63418675
Author: Róman Joost <roman@bromeco.de>
Date:   Sat Mar 28 10:33:39 2020 +1000

    Remove selectAll for now

    At this point we do not want to support toggling all items in a list due
    to performance concerns.

commit b40697fee779705b3835e1a9357fdcc990fa782d
Author: Fraser Tweedale <frase@frase.id.au>
Date:   Sun Mar 22 17:04:59 2020 +1000

    derive HasSelectableItemList for any context with (Bool, a) element type

commit e11d7bc1fc2414aaddf4c8312074dae7afd0906b
Author: Róman Joost <roman@bromeco.de>
Date:   Sun Mar 22 13:09:27 2020 +1000

    Provide a lens to operate on toggled items

commit 15cfcf41a4d24541ecf2464ce6832a98182880aa
Author: Róman Joost <roman@bromeco.de>
Date:   Sun Feb 16 14:41:00 2020 +1000

    Improve help for setTags action

    The 'apply given tags' isn't very helpful, particularly when we have a
    look at our help page in the UI:

         a - apply given tags
         S - apply given tags

    Both are distinct actions and the 'what' is missing here. This adds at
    least the show instances of the tag operations to make this part of the
    UI more helpful.

commit 583054f1b13c2604588aacfa2da0b5c977f87750
Author: Róman Joost <roman@bromeco.de>
Date:   Thu Feb 6 19:41:07 2020 +1000

    Bulk actions

    This implements the support for bulk actions, currently limited to
    tagging only. The major part of this patch is the support for tagging
    multiple items (either mail or thread) from our Brick list widgets now
    able to hold a toggle state in the list item itself.

    Fixes https://github.com/purebred-mua/purebred/issues/5

commit 8c08052ac151bb59cacc6c551c270c9679ed3ef7
Author: Róman Joost <roman@bromeco.de>
Date:   Thu Jan 30 20:12:26 2020 +1000

    Type alias to reflect marked list items

    This is a simple type alias which reflects list items which can be
    marked for bulk actions.
frasertweedale commented 4 years ago

@romanofski something busted in unit test suite:

test/TestActions.hs:32:18: error:
    Module ‘UI.Utils’ does not export ‘selectedFiles’
   |
32 | import UI.Utils (selectedFiles)
   |                  ^^^^^^^^^^^^^
cabal: Failed to build test:unit from purebred-0.1.0.0.
romanofski commented 4 years ago

@romanofski something busted in unit test suite:

test/TestActions.hs:32:18: error:
    Module ‘UI.Utils’ does not export ‘selectedFiles’
   |
32 | import UI.Utils (selectedFiles)
   |                  ^^^^^^^^^^^^^
cabal: Failed to build test:unit from purebred-0.1.0.0.

Hah! There is also an acceptance test failure I was investigating. Cheers for that. Saves me at least an additional run.

romanofski commented 4 years ago

Not done yet. Spend a few days to make the theme and colours more consistent, since it was becoming a bit of a hotchpotch with the additional toggled state (we now have to indicate: new mail, selected and toggled).

frasertweedale commented 4 years ago

good to merge?

romanofski commented 4 years ago

Yes :) Oof... took me quite a bit for this one.

frasertweedale commented 4 years ago

It's great work mate. Good on ya!

romanofski commented 4 years ago

Thank you @frasertweedale :)