From 887471f7785c74dd8ee5d300d3b1fb58e011c2cb Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 31 Mar 2021 09:41:59 +0200 Subject: view/html: issue-page: Include internal messages when assigning ids. * mumi/web/view/html.scm (issue-page): Consider all emails when generating identifiers. --- mumi/web/view/html.scm | 51 +++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm index b212972..5959bac 100644 --- a/mumi/web/view/html.scm +++ b/mumi/web/view/html.scm @@ -1,5 +1,5 @@ ;;; mumi -- Mediocre, uh, mail interface -;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus +;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ricardo Wurmus ;;; Copyright © 2018, 2019 Arun Isaac ;;; ;;; This program is free software: you can redistribute it and/or @@ -355,13 +355,18 @@ failed to process associated messages.") (define* (issue-page bug #:optional flash-message) "Render the conversation for the given BUG." (define id (bug-num bug)) - (define messages - (filter (lambda (msg) - ;; Ignore messages without body, and internal messages. - (and msg - (email-body msg) - (not (internal-message? msg)))) - (issue-messages id))) + (define all-messages-with-numbers + (let ((msgs (issue-messages id))) + (zip (iota (length msgs)) msgs))) + (define messages-with-numbers + (filter (match-lambda + ((number msg) + ;; Ignore messages without body, and internal messages. + (and msg + (email-body msg) + (not (internal-message? msg))))) + all-messages-with-numbers)) + (define messages (map second messages-with-numbers)) (define parties (sort (filter (compose (negate bot?) extract-email) (participants (filter identity messages))) (lambda (a b) @@ -370,20 +375,20 @@ failed to process associated messages.") (define sidebar `(ul (@ (id "sidebar") (class "sticky-top flex-column")) - ,(map (lambda (message message-number) - `(li - (div - (@ (class "avatar") - (style ,(string-append "background-color:" - (avatar-color (sender-email message) - (map extract-email parties))))) - ,(string-upcase (string-take (sender-name message) 1))) - (span (@ (class "date")) - (a (@ (href ,(string-append "#" (number->string - message-number)))) - ,(time->string (date message)))))) - messages - (iota (length messages))))) + ,(map (match-lambda + ((message-number message) + `(li + (div + (@ (class "avatar") + (style ,(string-append "background-color:" + (avatar-color (sender-email message) + (map extract-email parties))))) + ,(string-upcase (string-take (sender-name message) 1))) + (span (@ (class "date")) + (a (@ (href ,(string-append "#" (number->string + message-number)))) + ,(time->string (date message))))))) + messages-with-numbers))) (define issue-details `(span (@ (class "details")) ,(status-tag bug) @@ -621,7 +626,7 @@ currently disabled.")) (div (@ (class "conversation col-12")) ,(map show-message - (iota (length messages)) + (map car messages-with-numbers) messages (cons (bug-subject* bug) (map subject messages))) -- cgit v1.2.3