-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show depending and blocked PRs in the PR list #29117
Open
zokkis
wants to merge
35
commits into
go-gitea:main
Choose a base branch
from
zokkis:enhancement/show-blocking-in-issue-list
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
aa061b4
enhancement: Show blocked_by and blocking in issue-list-view
zokkis 925ac87
refactor: extract to subtemplate
zokkis 2b39981
chore: resolve lint errors
zokkis ad4d893
refactor: use translations to support rtl
zokkis 5c35d88
enhancement: shows divider
zokkis 67797f5
chore: lowercase
zokkis 586a42b
chore: lint -> double-quotes
zokkis 5b8d4aa
enhancement: line-through for closed issues
zokkis 20dcbad
review: Dependencies as template.HTML
zokkis f9726ea
style: middot as divider
zokkis d460a5c
performance: better sql
zokkis d6acba1
style: better popups
zokkis 28bca98
style: better selector for middot
zokkis eff4d30
chore: lint fix
zokkis f2ae3bd
refactor: use xorm builder
zokkis 0df1b37
enhancement: show dependencies only with enabled setting
zokkis c68b79f
chore: update swagger
zokkis c0d5bc4
chore: add documentation
zokkis f41b8fb
chore: corrected 'retrieve'
zokkis 58d7e4f
Apply suggestions from code review
6543 e0a4164
render issue-link in go-template
zokkis 9e33175
add final new line
zokkis c2d67ff
added test
zokkis fa199e7
move issues to be tested into higher range
6543 2994945
use tailwind
zokkis 86b1006
remove option from api
zokkis 899f5ad
chore: typo fix
zokkis 40c3343
remove join
zokkis 611cccb
added index to IssueDependency
zokkis 44cd718
Fix swagger
lunny 33fb710
Merge branch 'main' into enhancement/show-blocking-in-issue-list
silverwind 3051b0c
Merge remote-tracking branch 'origin/main' into enhancement/show-bloc…
zokkis c897fe6
improv: removed unused
zokkis 6ed8925
add svgs
silverwind f407475
Update templates/shared/issue_link.tmpl
silverwind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
- | ||
id: 1 | ||
user_id: 40 | ||
issue_id: 21 | ||
dependency_id: 20 | ||
|
||
- | ||
id: 2 | ||
user_id: 40 | ||
issue_id: 21 | ||
dependency_id: 22 | ||
|
||
- | ||
id: 3 | ||
user_id: 40 | ||
issue_id: 20 | ||
dependency_id: 22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -631,3 +631,55 @@ func (issues IssueList) LoadIsRead(ctx context.Context, userID int64) error { | |
|
||
return nil | ||
} | ||
|
||
func (issues IssueList) BlockingDependenciesMap(ctx context.Context) (issueDepsMap map[int64][]*DependencyInfo, err error) { | ||
var issueDeps []*DependencyInfo | ||
|
||
err = db.GetEngine(ctx). | ||
Table("issue"). | ||
Join("INNER", "repository", "repository.id = issue.repo_id"). | ||
6543 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Join("INNER", "issue_dependency", "issue_dependency.issue_id = issue.id"). | ||
Where(builder.In("issue_dependency.dependency_id", issues.getIssueIDs())). | ||
zokkis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// sort by repo id then index | ||
Asc("`issue`.`repo_id`"). | ||
Asc("`issue`.`index`"). | ||
Find(&issueDeps) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
issueDepsMap = make(map[int64][]*DependencyInfo, len(issues)) | ||
for _, depInfo := range issueDeps { | ||
depInfo.Issue.Repo = &depInfo.Repository | ||
|
||
issueDepsMap[depInfo.DependencyID] = append(issueDepsMap[depInfo.DependencyID], depInfo) | ||
} | ||
|
||
return issueDepsMap, nil | ||
} | ||
|
||
func (issues IssueList) BlockedByDependenciesMap(ctx context.Context) (issueDepsMap map[int64][]*DependencyInfo, err error) { | ||
var issueDeps []*DependencyInfo | ||
|
||
err = db.GetEngine(ctx). | ||
Table("issue"). | ||
Join("INNER", "repository", "repository.id = issue.repo_id"). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same as above. |
||
Join("INNER", "issue_dependency", "issue_dependency.dependency_id = issue.id"). | ||
Where(builder.In("issue_dependency.issue_id", issues.getIssueIDs())). | ||
zokkis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// sort by repo id then index | ||
Asc("`issue`.`repo_id`"). | ||
Asc("`issue`.`index`"). | ||
Find(&issueDeps) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
issueDepsMap = make(map[int64][]*DependencyInfo, len(issues)) | ||
for _, depInfo := range issueDeps { | ||
depInfo.Issue.Repo = &depInfo.Repository | ||
|
||
issueDepsMap[depInfo.IssueID] = append(issueDepsMap[depInfo.IssueID], depInfo) | ||
} | ||
|
||
return issueDepsMap, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{{if .Dependencies}} | ||
<div class="flex-text-inline"> | ||
{{ctx.Locale.Tr .TitleKey}} | ||
{{range $i, $dependency := .Dependencies}} | ||
{{if gt $i 0}}<span class="-tw-ml-1">, </span>{{end}} | ||
{{template "shared/issue_link" $dependency.Issue}} | ||
{{end}} | ||
</div> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<a href="{{.Link}}" class="{{if .IsClosed}}tw-line-through {{end}}tw-ml-1 ref-issue">#{{.Index}}</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -118,6 +118,16 @@ | |||||
</span> | ||||||
</span> | ||||||
{{end}} | ||||||
{{if $.BlockedByDependenciesMap}} | ||||||
{{template "shared/issue_dependency" (dict | ||||||
"Dependencies" (index $.BlockedByDependenciesMap .ID) | ||||||
"TitleKey" "repo.issues.dependency.blocked_by_following")}} | ||||||
{{end}} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{{if $.BlockingDependenciesMap}} | ||||||
{{template "shared/issue_dependency" (dict | ||||||
"Dependencies" (index $.BlockingDependenciesMap .ID) | ||||||
"TitleKey" "repo.issues.dependency.blocks_following")}} | ||||||
{{end}} | ||||||
{{if .IsPull}} | ||||||
{{$approveOfficial := call $approvalCounts .ID "approve"}} | ||||||
{{$rejectOfficial := call $approvalCounts .ID "reject"}} | ||||||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two nits:
IssueID
seems redundant, becauseissue_dependency
should already provide the index for it.