~migadu/alps-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH alps] themes/alps: handle messages without text parts

Details
Message ID
<169107689276.15119.4625081136957304232-0@git.sr.ht>
DKIM signature
missing
Download raw message
Patch: +3 -1
From: Konstantinos Koukas <contact@koukas.org>

Fixes: https://todo.sr.ht/~migadu/alps/165
---
 themes/alps/message.html | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/themes/alps/message.html b/themes/alps/message.html
index ee5aa02..93cc5c9 100644
--- a/themes/alps/message.html
+++ b/themes/alps/message.html
@@ -185,6 +185,7 @@
      {{ $text := .Message.TextPart }}
      <div class="tabs">
        {{/* https://github.com/golang/go/issues/31103 */}}
        {{ if $text }}
        <a
          href="?part={{$text.PathString}}"
          {{ if eq $text.PathString .Part.PathString }}
@@ -197,7 +198,7 @@
        Plain text
        {{ end }}
        </a>
        {{ if and $html $text }}
        {{ if $html }}
        {{ if ne $html.PathString $text.PathString }}
        <a
          href="?part={{$html.PathString}}"
@@ -207,6 +208,7 @@
        >HTML</a>
        {{ end }}
        {{ end }}
        {{ end }}
        <a href="{{.Message.URL}}/raw?plain=1">Raw email</a>
      </div>

-- 
2.38.5

[alps/patches/.build.yml] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CUJ0R73VI3W8.2Y5JC8OSHJGB1@cirno2>
In-Reply-To
<169107689276.15119.4625081136957304232-0@git.sr.ht> (view parent)
DKIM signature
missing
Download raw message
alps/patches/.build.yml: SUCCESS in 1m15s

[themes/alps: handle messages without text parts][0] from [~koukas][1]

[0]: https://lists.sr.ht/~migadu/alps-devel/patches/43251
[1]: contact@koukas.org

✓ #1034563 SUCCESS alps/patches/.build.yml https://builds.sr.ht/~migadu/job/1034563
Details
Message ID
<HHMZmydJfizKMBCzjz5QfSzuSbAvx9rNsgUrZCRb8eVNHlS8K25HcpO65AURQKKfLLbRraBWu-tzuEl9eytHLCkjsUCN0J1hZbVQ0pAXlt0=@emersion.fr>
In-Reply-To
<169107689276.15119.4625081136957304232-0@git.sr.ht> (view parent)
DKIM signature
missing
Download raw message
Hm, what if an e-mail has only an HTML part without a text part?

Re: [PATCH alps] themes/alps: handle messages without text parts (re-sending with public cc)

Details
Message ID
<ca56af4089aa0b4babcdbd14298409f24121e0ce@koukas.org>
In-Reply-To
<HHMZmydJfizKMBCzjz5QfSzuSbAvx9rNsgUrZCRb8eVNHlS8K25HcpO65AURQKKfLLbRraBWu-tzuEl9eytHLCkjsUCN0J1hZbVQ0pAXlt0=@emersion.fr> (view parent)
DKIM signature
missing
Download raw message
> Hm, what if an e-mail has only an HTML part without a text part?

In that case TextPart and HTMLPart are the same.
TextPart() returns either a text/plain or a text/html part, and plain text takes precedence:
https://git.sr.ht/~migadu/alps/tree/master/item/plugins/base/imap.go#L226-234

The first tab points to the HTML view and the condition for the second one is false:
https://git.sr.ht/~migadu/alps/tree/master/item/themes/alps/message.html#L201

Perhaps this logic can be re-written as a loop over message parts as in the SourceHut theme:
https://git.sr.ht/~migadu/alps/tree/master/item/themes/sourcehut/message.html#L49
Reply to thread Export thread (mbox)