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

simplify InputValidated event #449

Closed frasertweedale closed 2 years ago

frasertweedale commented 2 years ago

The InputValidated event currently contains a Lens to the AppState constituent that validation error messages should be written to. But at the moment the only target is asUserMessage. Furthermore, some places use the optics whereas other places on the "sink" side of the event channel still explicitly mention asUserMessage (e.g. when clearing the message).

Simplify the type by removing the Lens argument. Explicitly mention asUserMessage in all places, eliminating the contradictions and potential for confusion.

Perhaps we will need this behaviour again in the future - that is, to specify the part of the AppState that a validation error shall be written to. If that happens, we will implement this behaviour afresh, and hopefully avoid the aforementioned mistakes.