1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 02:12:41 +01:00

Fix an error in Diffusion when the Owners application is uninstalled

Summary:
See <https://discourse.phabricator-community.org/t/undefined-view-when-owners-is-uninstalled/451>.

When Owners is not installed, Diffusion can fatal with a bad `$view`.

Test Plan:
  - Uninstall Owners.
  - View the content of any file in Diffusion.
  - Before: fatal on `$view` undefined.
  - After: Valid page with no owners information.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18629
This commit is contained in:
epriestley 2017-09-19 09:22:10 -07:00
parent 23867c1487
commit 03e5d69817

View file

@ -799,12 +799,17 @@ final class DiffusionBrowseController extends DiffusionController {
} }
private function buildOwnersList(DiffusionRequest $drequest) { private function buildOwnersList(DiffusionRequest $drequest) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$have_owners = PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorOwnersApplication',
$viewer);
if (!$have_owners) {
return null;
}
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$owners = 'PhabricatorOwnersApplication';
if (PhabricatorApplication::isClassInstalled($owners)) {
$package_query = id(new PhabricatorOwnersPackageQuery()) $package_query = id(new PhabricatorOwnersPackageQuery())
->setViewer($viewer) ->setViewer($viewer)
->withStatuses(array(PhabricatorOwnersPackage::STATUS_ACTIVE)) ->withStatuses(array(PhabricatorOwnersPackage::STATUS_ACTIVE))
@ -866,7 +871,6 @@ final class DiffusionBrowseController extends DiffusionController {
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->addClass('diffusion-mobile-view') ->addClass('diffusion-mobile-view')
->setObjectList($ownership); ->setObjectList($ownership);
}
return $view; return $view;
} }