From 0692f437b6e9e22399f84adc0f8bad15e9341e09 Mon Sep 17 00:00:00 2001 From: IT-AlexKor <101557941+IT-AlexKor@users.noreply.github.com> Date: Wed, 25 May 2022 16:33:35 +0300 Subject: [PATCH 1/3] Show source/target branches on PR's list (#19747) Add ability to show source/target branches for Pull Request's list. It can be useful to see which branches are used in each PR right in the list. Co-authored-by: Alexey Korobkov Co-authored-by: wxiaoguang Co-authored-by: Lauris BH --- models/issue_list.go | 14 +++++++++----- templates/shared/issuelist.tmpl | 21 +++++++++++++++++++++ web_src/less/shared/issuelist.less | 17 +++++++++++++++++ 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/models/issue_list.go b/models/issue_list.go index 4a8f72a48b99..31588c02a471 100644 --- a/models/issue_list.go +++ b/models/issue_list.go @@ -25,15 +25,16 @@ const ( defaultMaxInSize = 50 ) +// get the repo IDs to be loaded later, these IDs are for issue.Repo and issue.PullRequest.HeadRepo func (issues IssueList) getRepoIDs() []int64 { repoIDs := make(map[int64]struct{}, len(issues)) for _, issue := range issues { - if issue.Repo != nil { - continue - } - if _, ok := repoIDs[issue.RepoID]; !ok { + if issue.Repo == nil { repoIDs[issue.RepoID] = struct{}{} } + if issue.PullRequest != nil && issue.PullRequest.HeadRepo == nil { + repoIDs[issue.PullRequest.HeadRepoID] = struct{}{} + } } return container.KeysInt64(repoIDs) } @@ -67,8 +68,11 @@ func (issues IssueList) loadRepositories(ctx context.Context) ([]*repo_model.Rep } else { repoMaps[issue.RepoID] = issue.Repo } - if issue.PullRequest != nil && issue.PullRequest.BaseRepo == nil { + if issue.PullRequest != nil { issue.PullRequest.BaseRepo = issue.Repo + if issue.PullRequest.HeadRepo == nil { + issue.PullRequest.HeadRepo = repoMaps[issue.PullRequest.HeadRepoID] + } } } return valuesRepository(repoMaps), nil diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 23fb76d500c0..5392365dd125 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -59,6 +59,27 @@ {{else}} {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} {{end}} + {{if .IsPull}} + + {{end}} {{if and .Milestone (ne $.listType "milestone")}} {{svg "octicon-milestone" 14 "mr-2"}}{{.Milestone.Name}} diff --git a/web_src/less/shared/issuelist.less b/web_src/less/shared/issuelist.less index 32fd206827d7..775fc984786d 100644 --- a/web_src/less/shared/issuelist.less +++ b/web_src/less/shared/issuelist.less @@ -119,6 +119,23 @@ } } + .branches { + display: inline-flex; + padding: 0 6px; + + .branch { + background-color: var(--color-secondary); + border-radius: 3px; + } + + .truncated-name { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 10em; + } + } + > .item + .item { border-top: 1px solid var(--color-secondary); } From 9574626a23569b09230ad6fe2b99357acab25d1a Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 25 May 2022 18:29:40 +0200 Subject: [PATCH 2/3] Fix follower display on user page (#19805) --- templates/user/profile.tmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index dd83ff0620ca..abcc227bec35 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -17,7 +17,9 @@ {{if .Owner.FullName}}{{.Owner.FullName}}{{end}} {{.Owner.Name}} {{svg "octicon-rss" 18}} - {{svg "octicon-person" 18 "mr-2"}}{{.Owner.NumFollowers}} {{.i18n.Tr "user.followers"}} · {{.Owner.NumFollowing}} {{.i18n.Tr "user.following"}} +
    From 8720f876c74e4ab63828a8ecd8b5f5465aef58fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Thu, 26 May 2022 03:19:24 -0600 Subject: [PATCH 3/3] Make WIP prefixes case insensitive, e.g. allow `Draft` as a WIP prefix (#19780) The issue was that only the actual title was converted to uppercase, but not the prefix as specified in `WORK_IN_PROGRESS_PREFIXES`. As a result, the following did not work: WORK_IN_PROGRESS_PREFIXES=Draft:,[Draft],WIP:,[WIP] One possible workaround was: WORK_IN_PROGRESS_PREFIXES=DRAFT:,[DRAFT],WIP:,[WIP] Then indeed one could use `Draft` (as well as `DRAFT`) in the title. However, the link `Start the title with DRAFT: to prevent the pull request from being merged accidentally.` showed the suggestion in uppercase; so it is not possible to show it as `Draft`. This PR fixes it, and allows to use `Draft` in `WORK_IN_PROGRESS_PREFIXES`. Fixes #19779. Co-authored-by: zeripath --- custom/conf/app.example.ini | 2 +- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 2 +- models/pull.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 476b30502681..8362f228123d 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -938,7 +938,7 @@ PATH = ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; -;; List of prefixes used in Pull Request title to mark them as Work In Progress +;; List of prefixes used in Pull Request title to mark them as Work In Progress (matched in a case-insensitive manner) ;WORK_IN_PROGRESS_PREFIXES = WIP:,[WIP] ;; ;; List of keywords used in Pull Request comments to automatically close a related issue diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 4c43ba7ddb9f..785fd3d6c25e 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -87,7 +87,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. ### Repository - Pull Request (`repository.pull-request`) - `WORK_IN_PROGRESS_PREFIXES`: **WIP:,\[WIP\]**: List of prefixes used in Pull Request - title to mark them as Work In Progress + title to mark them as Work In Progress. These are matched in a case-insensitive manner. - `CLOSE_KEYWORDS`: **close**, **closes**, **closed**, **fix**, **fixes**, **fixed**, **resolve**, **resolves**, **resolved**: List of keywords used in Pull Request comments to automatically close a related issue - `REOPEN_KEYWORDS`: **reopen**, **reopens**, **reopened**: List of keywords used in Pull Request comments to automatically reopen diff --git a/models/pull.go b/models/pull.go index bb5bb118122f..df96e2dc7458 100644 --- a/models/pull.go +++ b/models/pull.go @@ -588,7 +588,7 @@ func (pr *PullRequest) IsWorkInProgress() bool { // HasWorkInProgressPrefix determines if the given PR title has a Work In Progress prefix func HasWorkInProgressPrefix(title string) bool { for _, prefix := range setting.Repository.PullRequest.WorkInProgressPrefixes { - if strings.HasPrefix(strings.ToUpper(title), prefix) { + if strings.HasPrefix(strings.ToUpper(title), strings.ToUpper(prefix)) { return true } } @@ -609,7 +609,7 @@ func (pr *PullRequest) GetWorkInProgressPrefix() string { } for _, prefix := range setting.Repository.PullRequest.WorkInProgressPrefixes { - if strings.HasPrefix(strings.ToUpper(pr.Issue.Title), prefix) { + if strings.HasPrefix(strings.ToUpper(pr.Issue.Title), strings.ToUpper(prefix)) { return pr.Issue.Title[0:len(prefix)] } }