codescape / jira-multiple-subtasks

Multiple Subtasks for Jira

Home Page:http://jira-multiple-subtasks.codescape.de

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hide dialog menu entry in projects without subtasks

codescape opened this issue · comments

Jira has a condition com.atlassian.jira.plugin.webfragment.conditions.HasSubTasksAvailableCondition that is used to check whether an issue has subtasks available or not. This condition seems not to work in Multiple Subtasks for Jira.

Reference

Tasks

  • display the dialog menu entry only if subtasks are available to the project

This is what we are using right now... and this does not work in this case:

public class HasSubTasksAvailableCondition extends AbstractIssueWebCondition {

    private final FieldManager fieldManager;

    public HasSubTasksAvailableCondition(FieldManager fieldManager) {
        this.fieldManager = fieldManager;
    }

    public boolean shouldDisplay(ApplicationUser user, Issue issue, JiraHelper jiraHelper) {
        Collection<Option> availableSubTaskIssueTypes = this.fieldManager.getIssueTypeField().getOptionsForIssue(issue, true);
        return availableSubTaskIssueTypes != null && !availableSubTaskIssueTypes.isEmpty();
    }

}