-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Allow cross-repository dependencies on issues #7901
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
Changes from 25 commits
86442ad
ce3312a
f33a34b
6647aa8
f1bae29
935eae4
0473eca
52f0e19
0b9e67b
b426606
2f257d0
3c78743
662cf44
4e90f86
6d741b7
cf015b6
e630aa7
2af7328
1b08937
3a5f40b
deb2ff3
b7cd0f5
a707ea7
25c40a4
3a9028f
9dd2fc0
e629f7e
0327365
17b7888
2ab1058
690442c
cf36916
ea04606
49b7d2a
2ec084d
c77a950
c19468c
171465c
50680e4
074edcf
ddd3488
1d8bd09
22c5dd2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -377,6 +377,12 @@ func (issue *Issue) apiFormat(e Engine) *api.Issue { | |
| Updated: issue.UpdatedUnix.AsTime(), | ||
| } | ||
|
|
||
| apiIssue.Repo = &api.RepositoryMeta{ | ||
| ID: issue.Repo.ID, | ||
| Name: issue.Repo.Name, | ||
| FullName: issue.Repo.FullName(), | ||
| } | ||
|
|
||
| if issue.ClosedUnix != 0 { | ||
| apiIssue.Closed = issue.ClosedUnix.AsTimePtr() | ||
| } | ||
|
|
@@ -1790,8 +1796,8 @@ func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen | |
| } | ||
|
|
||
| // SearchIssueIDsByKeyword search issues on database | ||
| func SearchIssueIDsByKeyword(kw string, repoID int64, limit, start int) (int64, []int64, error) { | ||
| var repoCond = builder.Eq{"repo_id": repoID} | ||
| func SearchIssueIDsByKeyword(kw string, repoIDs []int64, limit, start int) (int64, []int64, error) { | ||
| var repoCond = builder.In("repo_id", repoIDs) | ||
| var subQuery = builder.Select("id").From("issue").Where(repoCond) | ||
| var cond = builder.And( | ||
| repoCond, | ||
|
|
@@ -1880,33 +1886,41 @@ func UpdateIssueDeadline(issue *Issue, deadlineUnix timeutil.TimeStamp, doer *Us | |
| return sess.Commit() | ||
| } | ||
|
|
||
| // DependencyInfo represents high level information about an issue which is a dependency of another issue. | ||
| type DependencyInfo struct { | ||
| Issue `xorm:"extends"` | ||
| Repository `xorm:"extends"` | ||
bhalbright marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // Get Blocked By Dependencies, aka all issues this issue is blocked by. | ||
| func (issue *Issue) getBlockedByDependencies(e Engine) (issueDeps []*Issue, err error) { | ||
| func (issue *Issue) getBlockedByDependencies(e Engine) (issueDeps []*DependencyInfo, err error) { | ||
| return issueDeps, e. | ||
| Table("issue_dependency"). | ||
| Select("issue.*"). | ||
| Join("INNER", "issue", "issue.id = issue_dependency.dependency_id"). | ||
| Table("issue"). | ||
| Join("INNER", "repository", "repository.id = issue.repo_id"). | ||
| Join("INNER", "issue_dependency", "issue_dependency.dependency_id = issue.id"). | ||
| Where("issue_id = ?", issue.ID). | ||
| OrderBy("repository.id, issue.id ASC"). | ||
|
||
| Find(&issueDeps) | ||
bhalbright marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // Get Blocking Dependencies, aka all issues this issue blocks. | ||
| func (issue *Issue) getBlockingDependencies(e Engine) (issueDeps []*Issue, err error) { | ||
| func (issue *Issue) getBlockingDependencies(e Engine) (issueDeps []*DependencyInfo, err error) { | ||
| return issueDeps, e. | ||
| Table("issue_dependency"). | ||
| Select("issue.*"). | ||
| Join("INNER", "issue", "issue.id = issue_dependency.issue_id"). | ||
| Table("issue"). | ||
| Join("INNER", "repository", "repository.id = issue.repo_id"). | ||
| Join("INNER", "issue_dependency", "issue_dependency.issue_id = issue.id"). | ||
| Where("dependency_id = ?", issue.ID). | ||
| OrderBy("repository.id, issue.id ASC"). | ||
| Find(&issueDeps) | ||
bhalbright marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // BlockedByDependencies finds all Dependencies an issue is blocked by | ||
| func (issue *Issue) BlockedByDependencies() ([]*Issue, error) { | ||
| func (issue *Issue) BlockedByDependencies() ([]*DependencyInfo, error) { | ||
| return issue.getBlockedByDependencies(x) | ||
| } | ||
|
|
||
| // BlockingDependencies returns all blocking dependencies, aka all other issues a given issue blocks | ||
| func (issue *Issue) BlockingDependencies() ([]*Issue, error) { | ||
| func (issue *Issue) BlockingDependencies() ([]*DependencyInfo, error) { | ||
| return issue.getBlockingDependencies(x) | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3096,11 +3096,10 @@ function deleteDependencyModal(id, type) { | |
| } | ||
|
|
||
| function initIssueList() { | ||
| const repolink = $('#repolink').val(); | ||
| $('#new-dependency-drop-list') | ||
| .dropdown({ | ||
| apiSettings: { | ||
| url: suburl + '/api/v1/repos/' + repolink + '/issues?q={query}', | ||
| url: suburl + '/api/v1/repos/issues/search?q={query}', | ||
|
||
| onResponse: function(response) { | ||
| const filteredResponse = {'success': true, 'results': []}; | ||
| const currIssueId = $('#new-dependency-drop-list').data('issue-id'); | ||
|
|
@@ -3111,7 +3110,8 @@ function initIssueList() { | |
| return; | ||
| } | ||
| filteredResponse.results.push({ | ||
| 'name' : '#' + issue.number + ' ' + htmlEncode(issue.title), | ||
| 'name' : '#' + issue.number + ' ' + htmlEncode(issue.title) + | ||
| '<div class="text small dont-break-out">' + htmlEncode(issue.repository.full_name) + '</div>', | ||
| 'value' : issue.id | ||
| }); | ||
| }); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.