summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-03-31 09:41:59 +0200
committerRicardo Wurmus <rekado@elephly.net>2021-03-31 09:41:59 +0200
commit887471f7785c74dd8ee5d300d3b1fb58e011c2cb (patch)
treea5615c632da847dce5190d30076713dcbb164e12
parent1ed5d85bb40f60994fff43c99add1b3ca646f2d1 (diff)
view/html: issue-page: Include internal messages when assigning ids.
* mumi/web/view/html.scm (issue-page): Consider all emails when generating identifiers.
-rw-r--r--mumi/web/view/html.scm51
1 files 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 <rekado@elephly.net>
+;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; 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)))