wangp / bower

A curses terminal client for the Notmuch email system
Other
128 stars 11 forks source link

Viewing excluded messages #43

Closed vivien closed 5 years ago

vivien commented 5 years ago

It is currently impossible to view a message with an excluded pattern, like spam. This is inconvenient in setup when e.g. Gmail where the anti-spam system is quite aggressive.

I sometimes run bower tag:spam to fix false positives. It gets even more complicated to inspect them when they are a reply within a legit thread (in which case they are shown as (excluded message).)

What would be your approach?

wangp commented 5 years ago

We might need to call notmuch show with --exclude=false to return all messages then just ignore any messages with the tag draft. Perhaps we can hide any excluded messages in the pager until the user presses a key (similar to collapsing parts and quoted text), but I think legitimate threads wouldn't have many excluded messages apart from drafts.

vivien commented 5 years ago

Some spam are sent as a reply to thread messages... You can easily simulate that by tagging a reply within a thread with +spam, going back to the index view and viewing the thread again.

I think it's important to keep bower simple and continue to respect the search.exclude_tags. The current look and feel of threads with excluded messages in them is nice.

Maybe just a key to toggle their display would be enough. So one can read a thread as usual, press the toggle key if there are any excluded messages, eventually unmark them as spam or delete a draft, and toggle the display again.

haasn commented 5 years ago

Two approaches that come to mind:

  1. Don't filter messages if filtering messages would make the thread empty. This would catch the common case of wanting to quickly view something that was mis-tagged as spam to see if it was a false positive. The justification here is that, to have arrived at this thread, you must have specifically performed a search term including an excluded tag, since otherwise the thread itself would have been excluded altogether.

  2. Actually go a step further and remember what search term you performed when transitioning from the search results to the thread display. If this search term includes an excluded tag as a positive subterm (i.e. behind an even number of "NOT" nodes if you view the expression as a graph), don't exclude that tag when viewing this thread result. That way if searching for e.g. "tag:spam" finds a reply embedded inside a thread that also contains non-spam messages, you will still be able to view it. In this sense, this logic would be more powerful than approach 1.

wangp commented 5 years ago

Good idea. Though bower doesn't actually have a search term parser (I don't want to maintain one) we don't need one: in the index view we have the set of tags for a thread, and that only contains exclude tags if the user specifically searched for them -- I think. We can pass those tags to notmuch search when opening the thread:

notmuch search --entire-thread=false ... -- thread:TID OR ( thread:TID tag:TAG1 tag:TAG2 ... )

You can test it on the exclude branch.

haasn commented 5 years ago

@wangp works perfectly

vivien commented 5 years ago

I'm not sure the understand the workflow in the exclude branch. Should I search for a tag that might be excluded?

wangp commented 5 years ago

Yes, search for the excluded tag you're interested in.

I've made some more changes on the exclude branch to perform the filtering of messages within bower. This makes it possible to display some information about excluded messages with replies; in particular, its tags, so you can see what tags caused it to be excluded.

vivien commented 5 years ago

hi guys, I've tested the latest exclude branch and I do not see how it is intended to work. Can you please give my following test a try?

Find a thread with several replies, mark one in the middle +spam (assuming spam is part of your search.exclude_tags, quit Bower and view the thread again. With both exclude and master branches, the message isn't shown at all, not even the usual (excluded message) line. Am I doing something wrong?

wangp commented 5 years ago

Does the message tagged with spam have any replies? If so, it should be shown as an excluded message. Otherwise it will not be visible at all.

Then you can return to the index view and add tag:spam to the search terms (make sure the search terms can match that particular message, not only another message in the same thread). You should see the thread with the spam tag next to it. When you open the thread, the message should be displayed as normal.

wangp commented 5 years ago

I've merged the branch; should be good enough.

dtzWill commented 5 years ago

FWIW my brief intentional testing showed things working as I expected, and overall using the exclude branch (and now what was merged) works as expected without breaking my normal usage.

Ancedotal to be sure but perhaps adds a minor bit of confidence re:changes :).

Thanks!

On Sat, 09 Feb 2019 16:54:46 -0800, wangp notifications@github.com wrote:

Closed #43.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/wangp/bower/issues/43#event-2128991675Non-text part: text/html