Commits

Charles O'Farrell  committed 5e8209e

FUSE-129 Hide the review tab as well

  • Participants
  • Parent commits bde6e4d

Comments (0)

Files changed (2)

File src/main/java/com/atlassian/jirafisheyeplugin/web/issuetabpanel/crucible/CrucibleIssueTabPanel.java

 public class CrucibleIssueTabPanel extends AbstractFishEyeCrucibleIssueTabPanel {
     private static final Logger log = LoggerFactory.getLogger(CrucibleIssueTabPanel.class);
 
+    private static final String ALWAYS_SHOW = "jira.fisheye.issue.reviewtab.alwaysshow";
     private static final ReviewActionComparator REVIEW_ACTION_COMPARATOR = new ReviewActionComparator();
 
     private final FishEyeManager fisheyeManager;
         boolean crucibleEnabled = fisheyeManager.isCrucibleEnabled(project);
         log.debug("crucible integration is enabled = " + crucibleEnabled);
         boolean validConfig = fisheyeManager.hasValidConfig();
-        log.debug("FE manager has valid config = " + validConfig);
+        // If _all_ of the fisheye instances support dev-summary then don't show the tab
+        boolean validAndNoSummary = validConfig && (Boolean.getBoolean(ALWAYS_SHOW) || fisheyeManager.hasNoSummary());
+        log.debug("FE manager has valid config = {} and no summary = {}", validConfig, validAndNoSummary);
         boolean showPanelDetails = showPanelHelper.showIssuePanel(issue, remoteUser, fisheyeManager,
-                                                                  fisheyeConfig, projectKey, validConfig,
+                                                                  fisheyeConfig, projectKey, validAndNoSummary,
                                                                   ShowPanelHelper.PageType.ISSUE_TAB_CRU);
-        if (validConfig) {
+        if (validAndNoSummary) {
             //show Panel
             return crucibleEnabled && showPanelDetails;
         } else {

File src/test/java/com/atlassian/jirafisheyeplugin/web/issuetabpanel/crucible/TestCrucibleIssueTabPanel.java

 
     public void testShowPanelWhenCrucibleIntegrationIsNotEnabled() {
         initShowPanelMockExpectations(false, true, false);
+        mockFishEyeManager.expects(once()).method("hasNoSummary").withNoArguments()
+                .will(returnValue(false));
 
         assertFalse(crucibleIssueTabPanel.showPanel(new ShowPanelRequest(issue, null)));
     }
     }
 
     public void testShowPanelWhenFisheyeManagerReportsNoValidConfiguration() {
-        initShowPanelMockExpectations(true, false, true);
-
+        initShowPanelMockExpectations(true, true, true);
+        mockFishEyeManager.expects(once()).method("hasNoSummary").withNoArguments()
+                .will(returnValue(true));
         assertTrue(crucibleIssueTabPanel.showPanel(new ShowPanelRequest(issue, null)));
     }
 
                         eq(fishEyeManager),
                         eq(fishEyeConfig),
                         eq(PROJECT_KEY),
-                        eq(hasValidConfig),
+                        eq(showIssuePanel),
                         eq(ShowPanelHelper.PageType.ISSUE_TAB_CRU)
                 })
                 .will(returnValue(showIssuePanel));