Skip to content
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

Don't list an issue on its own dependency list UI. #5658

Merged
merged 2 commits into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2810,21 +2810,27 @@ function deleteDependencyModal(id, type) {

function initIssueList() {
var repolink = $('#repolink').val();
$('.new-dependency-drop-list')
$('#new-dependency-drop-list')
.dropdown({
apiSettings: {
url: suburl + '/api/v1/repos/' + repolink + '/issues?q={query}',
onResponse: function(response) {
var filteredResponse = {'success': true, 'results': []};
var currIssueId = $('#new-dependency-drop-list').data('issue-id');
// Parse the response from the api to work with our dropdown
$.each(response, function(index, issue) {
// Don't list current issue in the dependency list.
if(issue.id === currIssueId) {
return;
}
filteredResponse.results.push({
'name' : '#' + issue.number + ' ' + htmlEncode(issue.title),
'value' : issue.id
});
});
return filteredResponse;
},
cache: false,
lafriks marked this conversation as resolved.
Show resolved Hide resolved
},

fullTextSearch: true
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
<form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/dependency/add" id="addDependencyForm">
{{$.CsrfTokenHtml}}
<div class="ui fluid action input">
<div class="ui search selection dropdown new-dependency-drop-list" style="min-width: 13.9rem;border-radius: 4px 0 0 4px;border-right: 0;white-space: nowrap;">
<div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}" style="min-width: 13.9rem;border-radius: 4px 0 0 4px;border-right: 0;white-space: nowrap;">
<input name="newDependency" type="hidden">
<i class="dropdown icon"></i>
<input type="text" class="search">
Expand Down