summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-05-15 14:47:32 +0200
committerRicardo Wurmus <rekado@elephly.net>2019-05-15 14:47:32 +0200
commit7f86c514b47a9ddb3d84f31a16a6967ac2161801 (patch)
tree4baf887690bfacfb1a8cdfec0bd846d629716372
parentdfe3ff02678ed92d5ae88530236fa74f376021e8 (diff)
view: Handle bugs without subjects gracefully.
* mumi/messages.scm (subject): Always return a string. * mumi/web/view/html.scm (bug-subject*): New procedure. (issue-page, list-of-bugs): Use it.
-rw-r--r--mumi/messages.scm2
-rw-r--r--mumi/web/view/html.scm19
2 files changed, 11 insertions, 10 deletions
diff --git a/mumi/messages.scm b/mumi/messages.scm
index 63534a0..9409f34 100644
--- a/mumi/messages.scm
+++ b/mumi/messages.scm
@@ -78,7 +78,7 @@ yet. Return new results alongside cached results."
(header message 'date))
(define-public (subject message)
- (header message 'subject))
+ (or (header message 'subject) "(no subject)"))
(define-public (message-id message)
(header message 'message-id))
diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm
index 8804213..ea05a34 100644
--- a/mumi/web/view/html.scm
+++ b/mumi/web/view/html.scm
@@ -34,6 +34,9 @@
list-of-bugs
priority-bugs))
+(define (bug-subject* bug)
+ (or (bug-subject bug) "(no subject)"))
+
(define (status-tag bug)
"Return a colored tag indicating the BUG status."
(let ((status (if (bug-done bug) "Done" "Open")))
@@ -292,9 +295,7 @@ range. The supported arguments are the same as for "
(a (@ (href ,(string-append "#" (number->string
message-number))))
,(date->string (date message)))))
- ,@(if (or (string-suffix? (or previous-subject "")
- (or (subject message) ""))
- (not (subject message)))
+ ,@(if (string-suffix? previous-subject (subject message))
'()
`((div (@ (class "subject")) ,(subject message))))
(div
@@ -320,7 +321,7 @@ range. The supported arguments are the same as for "
(div (@ (class "label label-primary closed")) "Closed"))))
'())))
(layout
- #:title (bug-subject bug)
+ #:title (bug-subject* bug)
#:extra-headers
(cond
((bug-archived bug)
@@ -336,7 +337,7 @@ range. The supported arguments are the same as for "
(@ (class "container"))
(div
(@ (class "row title col-md-12"))
- (h1 ,(bug-subject bug))
+ (h1 ,(bug-subject* bug))
(span (@ (class "details"))
,(status-tag bug)
,(string-append "Submitted by "
@@ -407,7 +408,7 @@ range. The supported arguments are the same as for "
(show-message message-number msg previous-subject))
(iota (length msgs))
msgs
- (cons (bug-subject bug)
+ (cons (bug-subject* bug)
(map subject msgs))))
(div
(@ (class "row comment-box"))
@@ -429,7 +430,7 @@ range. The supported arguments are the same as for "
supported. To comment on this conversation "
(a (@ (href ,(string-append "mailto:"
(number->string id) "@" (%config 'debbugs-domain)
- "?subject=" (bug-subject bug))))
+ "?subject=" (bug-subject* bug))))
,(string-append "send email to "
(number->string id) "@" (%config 'debbugs-domain)))))))))
@@ -478,8 +479,8 @@ supported. To comment on this conversation "
(td ,(or id "-"))
(td ,(if id
`(a (@ (href ,(string-append "/issue/" id)))
- ,(bug-subject bug))
- (bug-subject bug)))
+ ,(bug-subject* bug))
+ (bug-subject* bug)))
(td ,(date->string (bug-date bug)))
(td ,(status-tag bug)))))
bugs)))))