From db55c403de5ae5b6e7790469c213120b1bbacbcf Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 1 Feb 2020 21:54:25 +0800 Subject: [PATCH 1/4] Fix branch page pull request title and link error (#10092) * Fix branch page pull request title and link error * Fix ui --- routers/repo/branch.go | 2 +- templates/repo/branch/list.tmpl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/routers/repo/branch.go b/routers/repo/branch.go index f57e76d4940a1..93eb384810421 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -221,6 +221,7 @@ func loadBranches(ctx *context.Context) []*Branch { } else { repoIDToRepo[pr.BaseRepoID] = pr.BaseRepo } + pr.Issue.Repo = pr.BaseRepo if pr.HasMerged { baseGitRepo, ok := repoIDToGitRepo[pr.BaseRepoID] @@ -243,7 +244,6 @@ func loadBranches(ctx *context.Context) []*Branch { mergeMovedOn = true } } - } branches[i] = &Branch{ diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 7707b3cf1de85..4ec0c04200675 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -73,7 +73,7 @@ {{end}} - + {{if not .LatestPullRequest}} {{if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} @@ -87,13 +87,13 @@ {{end}} {{else}} - #{{.LatestPullRequest.Issue.Index}} + {{if not .LatestPullRequest.IsSameRepo}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}} {{if .LatestPullRequest.HasMerged}} - {{$.i18n.Tr "repo.pulls.merged"}} + {{$.i18n.Tr "repo.pulls.merged"}} {{else if .LatestPullRequest.Issue.IsClosed}} - {{$.i18n.Tr "repo.issues.closed_title"}} + {{$.i18n.Tr "repo.issues.closed_title"}} {{else}} - {{$.i18n.Tr "repo.issues.open_title"}} + {{$.i18n.Tr "repo.issues.open_title"}} {{end}} {{end}} From 4f9414226c9989909b6072365af72b5767d89b20 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 13 Feb 2020 13:22:15 +0800 Subject: [PATCH 2/4] Fix reply on code review (#10227) Co-authored-by: zeripath --- public/js/index.js | 8 ++++++++ templates/repo/diff/comment_form.tmpl | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/public/js/index.js b/public/js/index.js index c04af8cbe4f13..484a4b39e726e 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -3171,6 +3171,14 @@ function cancelCodeComment(btn) { form.closest('.comment-code-cloud').remove() } } + +function submitReply(btn) { + const form = $(btn).closest('form'); + if (form.length > 0 && form.hasClass('comment-form')) { + form.submit(); + } +} + function onOAuthLoginClick() { const oauthLoader = $('#oauth2-login-loader'); const oauthNav = $('#oauth2-login-navigator'); diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl index 38fd3fa7fb4eb..5f3bbc4483a6b 100644 --- a/templates/repo/diff/comment_form.tmpl +++ b/templates/repo/diff/comment_form.tmpl @@ -26,7 +26,8 @@ {{$.root.i18n.Tr "repo.diff.comment.markdown_info"}}
{{if $.reply}} - + + {{else}} {{if $.root.CurrentReview}}
{{end}} - + {{if not .LatestPullRequest}} {{if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} @@ -87,13 +87,13 @@ {{end}} {{else}} - {{if not .LatestPullRequest.IsSameRepo}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}} + #{{.LatestPullRequest.Issue.Index}} {{if .LatestPullRequest.HasMerged}} - {{$.i18n.Tr "repo.pulls.merged"}} + {{$.i18n.Tr "repo.pulls.merged"}} {{else if .LatestPullRequest.Issue.IsClosed}} - {{$.i18n.Tr "repo.issues.closed_title"}} + {{$.i18n.Tr "repo.issues.closed_title"}} {{else}} - {{$.i18n.Tr "repo.issues.open_title"}} + {{$.i18n.Tr "repo.issues.open_title"}} {{end}} {{end}} From 6a021e9409fa7872dac5a7de6bbce96ab0e963cf Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 14 Feb 2020 18:24:58 +0800 Subject: [PATCH 4/4] Fix lint --- public/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/index.js b/public/js/index.js index 484a4b39e726e..46ff00d01c46d 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1,6 +1,6 @@ /* globals wipPrefixes, issuesTribute, emojiTribute */ /* exported timeAddManual, toggleStopwatch, cancelStopwatch, initHeatmap */ -/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */ +/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, submitReply, cancelCodeComment, onOAuthLoginClick */ 'use strict'; function htmlEncode(text) {