dmitri.shuralyov.com/website/gido/...

Issues can have empty titles, making them impossible to click. #1

Opendmitshur opened this issue 11 months ago
dmitshur commented 11 months ago

After parsing and trimming the import path prefix, an issue title can end up being blank. For example, issue https://golang.org/issues/8650 has title compress/zlib:, which is parsed as an issue in compress/zlib package with an empty title:

Image

That makes it impossible to click on the issue and find out more about it.

(Originally reported by Jimmy Frasche at https://groups.google.com/d/msg/golang-dev/KwB6agNiePc/r5U2KngMAgAJ.)

Write Preview Markdown
dmitshur commented 11 months ago

I've prototyped a fix that looks like this:

Image

Code Diff

diff --git a/component/issues.go b/component/issues.go
index 1de627d..5beaba2 100644
--- a/component/issues.go
+++ b/component/issues.go
@@ -89,6 +89,13 @@ func (i IssueEntry) Render() []*html.Node {
 		Attr: []html.Attribute{{Key: atom.Style.String(), Val: "flex-grow: 1;"}},
 	}
 	{
+		titleText := htmlg.Strong(i.Issue.Title)
+		if i.Issue.Title == "" {
+			titleText = &html.Node{
+				Type: html.ElementNode, Data: atom.Em.String(),
+				FirstChild: htmlg.Text("No title."),
+			}
+		}
 		title := htmlg.Div(
 			&html.Node{
 				Type: html.ElementNode, Data: atom.A.String(),
@@ -96,7 +103,7 @@ func (i IssueEntry) Render() []*html.Node {
 					{Key: atom.Class.String(), Val: "black"},
 					{Key: atom.Href.String(), Val: fmt.Sprintf("%s/%d", i.BaseURI, i.Issue.ID)},
 				},
-				FirstChild: htmlg.Strong(i.Issue.Title),
+				FirstChild: titleText,
 			},
 		)
 		for _, l := range i.Issue.Labels {

However, I want to think some more before I go through with it. There might be a better solution.

Write Preview Markdown
to comment.