Skip to content
Permalink
Browse files
[FIXED JENKINS-20143] Pass full list of all possible jobs to ViewJobF…
…ilter when recurse option is set

(cherry picked from commit 7115589)

Conflicts:
	changelog.html
  • Loading branch information
ndeloof authored and olivergondza committed Nov 5, 2013
1 parent 3493bfa commit c8e447bd2e7d0f1e67cce7ed396323f84eed75d4
Showing with 14 additions and 0 deletions.
  1. +14 −0 core/src/main/java/hudson/model/ListView.java
@@ -175,6 +175,7 @@ public boolean hasJobFilterExtensions() {
// check the filters
Iterable<ViewJobFilter> jobFilters = getJobFilters();
List<TopLevelItem> allItems = new ArrayList<TopLevelItem>(parentItems);
if (recurse) allItems = expand(allItems, new ArrayList<TopLevelItem>());
for (ViewJobFilter jobFilter: jobFilters) {
items = jobFilter.filter(items, allItems, this);
}
@@ -183,6 +184,19 @@ public boolean hasJobFilterExtensions() {

return items;
}

private List<TopLevelItem> expand(Collection<TopLevelItem> items, List<TopLevelItem> allItems) {
for (Item item : items) {
if (item instanceof ItemGroup) {
ItemGroup<TopLevelItem> ig = (ItemGroup<TopLevelItem>) item;
expand(ig.getItems(), allItems);
}
if (item instanceof TopLevelItem) {
allItems.add((TopLevelItem) item);
}
}
return allItems;
}

@Override
public boolean contains(TopLevelItem item) {

0 comments on commit c8e447b

Please sign in to comment.