mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Don't list an issue on its own dependency list UI. (#5658)
Fixes: #4684.
This commit is contained in:
		
				
					committed by
					
						
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							270fa6d63b
						
					
				
				
					commit
					1ac8f6fb83
				
			@@ -2810,14 +2810,19 @@ 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
 | 
			
		||||
@@ -2825,6 +2830,7 @@ function initIssueList() {
 | 
			
		||||
                    });
 | 
			
		||||
                    return filteredResponse;
 | 
			
		||||
                },
 | 
			
		||||
                cache: false,
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
            fullTextSearch: true
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user