summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac <arunisaac@systemreboot.net>2018-09-25 11:55:46 +0530
committerRicardo Wurmus <rekado@elephly.net>2018-11-09 19:50:27 +0100
commitfe14ac2a209d918d4f86cbcc0f5137a5fdfef801 (patch)
treef813e1d89314809bc41fd8c097b4de2eb332ebb0
parent5d68d1d5a29a404f91cd89cbea72c3f557f65518 (diff)
Use iota generated message numbers instead of debbugs' msg-num.
* mumi/messages.scm (extract-attachment): Use nth instead of find to get message. * mumi/web/view/html.scm (issue-page): Let show-message accept message-number as an argument. Update invocations of show-message. * mumi/web/view/utils.scm (display-message-body): Accept message-number as an argument.
-rw-r--r--mumi/messages.scm5
-rw-r--r--mumi/web/view/html.scm14
-rw-r--r--mumi/web/view/utils.scm5
3 files changed, 13 insertions, 11 deletions
diff --git a/mumi/messages.scm b/mumi/messages.scm
index d24de85..6c33e8a 100644
--- a/mumi/messages.scm
+++ b/mumi/messages.scm
@@ -1,5 +1,6 @@
;;; mumi -- Mediocre, uh, mail interface
;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This program is free software: you can redistribute it and/or
;;; modify it under the terms of the GNU Affero General Public License
@@ -299,9 +300,7 @@ we have to do this in a very convoluted way."
(cadr (find-tail (cut eq? #:body <>) chunk)))))))))
(and=> (fetch-bug id)
(lambda (bug)
- (and=> (find (lambda (msg)
- (eq? (email-msg-num msg) msg-num))
- (patch-messages id))
+ (and=> (nth msg-num (patch-messages id))
(lambda (msg)
(and=> (multipart-message? msg)
(lambda (attributes)
diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm
index 1f2408c..cee265f 100644
--- a/mumi/web/view/html.scm
+++ b/mumi/web/view/html.scm
@@ -1,5 +1,6 @@
;;; mumi -- Mediocre, uh, mail interface
;;; Copyright © 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This program is free software: you can redistribute it and/or
;;; modify it under the terms of the GNU Affero General Public License
@@ -256,10 +257,10 @@ range. The supported arguments are the same as for "
(lambda (a b)
(string< (extract-email a)
(extract-email b)))))
- (define (show-message message previous-subject)
+ (define (show-message message-number message previous-subject)
`((div
(@ (class "row"))
- (a (@ (id ,(number->string (email-msg-num message)))))
+ (a (@ (id ,(number->string message-number))))
(div
(@ (class "avatar col-md-1")
(style ,(string-append "background-color:"
@@ -278,7 +279,7 @@ range. The supported arguments are the same as for "
" wrote on "
(span (@ (class "date"))
(a (@ (href ,(string-append "#" (number->string
- (email-msg-num message)))))
+ message-number))))
,(date message))))
,@(if (string-suffix? previous-subject (subject message))
'()
@@ -297,7 +298,7 @@ range. The supported arguments are the same as for "
,(message-id message))))
(div
(@ (class "body panel-body"))
- ,(display-message-body id message)))))
+ ,(display-message-body id message-number message)))))
,@(if (closing? message id)
'((div
(@ (class "row event"))
@@ -344,8 +345,9 @@ range. The supported arguments are the same as for "
(and (email-body msg)
(not (internal-message? msg))))
messages)))
- (map (lambda (msg previous-subject)
- (show-message msg previous-subject))
+ (map (lambda (message-number msg previous-subject)
+ (show-message message-number msg previous-subject))
+ (iota (length msgs))
msgs
(cons (bug-subject bug)
(map subject msgs))))
diff --git a/mumi/web/view/utils.scm b/mumi/web/view/utils.scm
index 2c03c35..cb4e83e 100644
--- a/mumi/web/view/utils.scm
+++ b/mumi/web/view/utils.scm
@@ -1,5 +1,6 @@
;;; mumi -- Mediocre, uh, mail interface
;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This program is free software: you can redistribute it and/or
;;; modify it under the terms of the GNU Affero General Public License
@@ -107,7 +108,7 @@
(string-take value (or (string-index value #\;)
(string-length value)))))
-(define (display-message-body bug-num message)
+(define (display-message-body bug-num message-number message)
"Convenience procedure to render MESSAGE (part of bug with number
BUG-NUM), even when it is a multipart message."
(define (display-multipart-chunk headers body . path)
@@ -115,7 +116,7 @@ BUG-NUM), even when it is a multipart message."
(string-append "/issue/"
(number->string bug-num)
"/attachment/"
- (number->string (email-msg-num message))
+ (number->string message-number)
"/" (string-join (map number->string path) "/")))
(let* ((type
(and=> (assoc-ref headers "content-type")