Skip to content

Commit

Permalink
[FIXED JENKINS-20143] Pass full list of all possible jobs to ViewJobF…
Browse files Browse the repository at this point in the history
…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 c8e447b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/src/main/java/hudson/model/ListView.java
Expand Up @@ -175,6 +175,7 @@ public List<TopLevelItem> getItems() {
// 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);
}
Expand All @@ -183,6 +184,19 @@ public List<TopLevelItem> getItems() {

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) {
Expand Down

0 comments on commit c8e447b

Please sign in to comment.