Skip to content

Commit

Permalink
Prettify Timeline (#10972)
Browse files Browse the repository at this point in the history
Co-authored-by: mrsdizzie <[email protected]>
  • Loading branch information
Sorien and mrsdizzie authored Apr 10, 2020
1 parent bc362ea commit c97e988
Show file tree
Hide file tree
Showing 9 changed files with 296 additions and 216 deletions.
10 changes: 5 additions & 5 deletions integrations/issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func testNewIssue(t *testing.T, session *TestSession, user, repo, title, content
htmlDoc = NewHTMLParser(t, resp.Body)
val := htmlDoc.doc.Find("#issue-title").Text()
assert.Equal(t, title, val)
val = htmlDoc.doc.Find(".comment-list .comments .comment .render-content p").First().Text()
val = htmlDoc.doc.Find(".comment .render-content p").First().Text()
assert.Equal(t, content, val)

return issueURL
Expand All @@ -154,7 +154,7 @@ func testIssueAddComment(t *testing.T, session *TestSession, issueURL, content,
link, exists := htmlDoc.doc.Find("#comment-form").Attr("action")
assert.True(t, exists, "The template has changed")

commentCount := htmlDoc.doc.Find(".comment-list .comments .comment .render-content").Length()
commentCount := htmlDoc.doc.Find(".comment-list .comment .render-content").Length()

req = NewRequestWithValues(t, "POST", link, map[string]string{
"_csrf": htmlDoc.GetCSRF(),
Expand All @@ -168,10 +168,10 @@ func testIssueAddComment(t *testing.T, session *TestSession, issueURL, content,

htmlDoc = NewHTMLParser(t, resp.Body)

val := htmlDoc.doc.Find(".comment-list .comments .comment .render-content p").Eq(commentCount).Text()
val := htmlDoc.doc.Find(".comment-list .comment .render-content p").Eq(commentCount).Text()
assert.Equal(t, content, val)

idAttr, has := htmlDoc.doc.Find(".comment-list .comments .comment").Eq(commentCount).Attr("id")
idAttr, has := htmlDoc.doc.Find(".comment-list .comment").Eq(commentCount).Attr("id")
idStr := idAttr[strings.LastIndexByte(idAttr, '-')+1:]
assert.True(t, has)
id, err := strconv.Atoi(idStr)
Expand All @@ -197,7 +197,7 @@ func TestIssueCommentClose(t *testing.T) {
req := NewRequest(t, "GET", issueURL)
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
val := htmlDoc.doc.Find(".comment-list .comments .comment .render-content p").First().Text()
val := htmlDoc.doc.Find(".comment-list .comment .render-content p").First().Text()
assert.Equal(t, "Description", val)
}

Expand Down
4 changes: 2 additions & 2 deletions integrations/pull_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ func TestPullCreate_TitleEscape(t *testing.T) {
req = NewRequest(t, "GET", url)
resp = session.MakeRequest(t, req, http.StatusOK)
htmlDoc = NewHTMLParser(t, resp.Body)
titleHTML, err := htmlDoc.doc.Find(".comments .event .text b").First().Html()
titleHTML, err := htmlDoc.doc.Find(".comment-list .timeline-item.event .text b").First().Html()
assert.NoError(t, err)
assert.Equal(t, "<strike>&lt;i&gt;XSS PR&lt;/i&gt;</strike>", titleHTML)
titleHTML, err = htmlDoc.doc.Find(".comments .event .text b").Next().Html()
titleHTML, err = htmlDoc.doc.Find(".comment-list .timeline-item.event .text b").Next().Html()
assert.NoError(t, err)
assert.Equal(t, "&lt;u&gt;XSS PR&lt;/u&gt;", titleHTML)
})
Expand Down
2 changes: 1 addition & 1 deletion integrations/pull_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func testPullCleanUp(t *testing.T, session *TestSession, user, repo, pullnum str

// Click the little green button to create a pull
htmlDoc := NewHTMLParser(t, resp.Body)
link, exists := htmlDoc.doc.Find(".comments .merge .delete-button").Attr("data-url")
link, exists := htmlDoc.doc.Find(".timeline-item .delete-button").Attr("data-url")
assert.True(t, exists, "The template has changed")
req = NewRequestWithValues(t, "POST", link, map[string]string{
"_csrf": htmlDoc.GetCSRF(),
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,7 @@ issues.review.self.approval = You cannot approve your own pull request.
issues.review.self.rejection = You cannot request changes on your own pull request.
issues.review.approve = "approved these changes %s"
issues.review.comment = "reviewed %s"
issues.review.left_comment = left a comment
issues.review.content.empty = You need to leave a comment indicating the requested change(s).
issues.review.reject = "requested changes %s"
issues.review.wait = "was requested for review %s"
Expand Down
16 changes: 8 additions & 8 deletions templates/repo/issue/view_content.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

{{ $createdStr:= TimeSinceUnix .Issue.CreatedUnix $.Lang }}
<div class="twelve wide column comment-list prevent-before-timeline">
<ui class="ui comments timeline-line">
<div id="{{.Issue.HashTag}}" class="comment">
<ui class="ui timeline">
<div id="{{.Issue.HashTag}}" class="timeline-item comment first">
{{if .Issue.OriginalAuthor }}
<span class="avatar"><img src="/img/avatar_default.png"></span>
<span class="timeline-avatar"><img src="/img/avatar_default.png"></span>
{{else}}
<a class="avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
<a class="timeline-avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
<img src="{{.Issue.Poster.RelAvatarLink}}">
</a>
{{end}}
Expand Down Expand Up @@ -67,8 +67,8 @@
{{end}}
{{if .IsSigned}}
{{ if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (or (not .Issue.IsLocked))) (not .Repository.IsArchived) }}
<div class="comment form">
<a class="avatar" href="{{.SignedUser.HomeLink}}">
<div class="timeline-item comment form">
<a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
<img src="{{.SignedUser.RelAvatarLink}}">
</a>
<div class="content">
Expand Down Expand Up @@ -116,8 +116,8 @@
{{else}}
{{if .IsSigned}}
{{if .Repository.IsArchived}}
<div class="comment form">
<a class="avatar" href="{{.SignedUser.HomeLink}}">
<div class="timeline-item comment form">
<a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
<img src="{{.SignedUser.RelAvatarLink}}">
</a>
<div class="content">
Expand Down
Loading

0 comments on commit c97e988

Please sign in to comment.