Page MenuHomePhorge

D25574.1734729445.diff
No OneTemporary

D25574.1734729445.diff

diff --git a/src/applications/diffusion/controller/DiffusionCloneController.php b/src/applications/diffusion/controller/DiffusionCloneController.php
--- a/src/applications/diffusion/controller/DiffusionCloneController.php
+++ b/src/applications/diffusion/controller/DiffusionCloneController.php
@@ -6,6 +6,19 @@
return true;
}
+ /**
+ * Provide action label for a code repository URI
+ *
+ * @param PhabricatorRepository Repository
+ * @return PhutilSafeHTML Label of the Clone URI
+ */
+ private function getCloneLabel(PhabricatorRepository $repository) {
+ if ($repository->isSVN()) {
+ return phutil_tag_div('diffusion-clone-label', pht('Checkout'));
+ }
+ return phutil_tag_div('diffusion-clone-label', pht('Clone'));
+ }
+
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$response = $this->loadDiffusionContext();
@@ -23,24 +36,35 @@
$warning = null;
$uris = $repository->getURIs();
- foreach ($uris as $uri) {
- if ($uri->getIsDisabled()) {
- continue;
- }
- if ($uri->getEffectiveDisplayType() == $display_never) {
- continue;
+ // If Differential is uninstalled and the repo is observed (=not hosted),
+ // only expose its external canonical URI, ignoring all URIs' display
+ // preferences and ignoring if the observed canonical URI is enabled.
+ if (!id(new PhabricatorDifferentialApplication())->isInstalled() &&
+ !$repository->isHosted()) {
+ foreach ($uris as $uri) {
+ if ($uri->getEffectiveIOType() ==
+ PhabricatorRepositoryURI::IO_OBSERVE) {
+ $view->addProperty(
+ $this->getCloneLabel($repository),
+ $this->renderCloneURI($repository, $uri));
+ break;
+ }
}
-
- if ($repository->isSVN()) {
- $label = phutil_tag_div('diffusion-clone-label', pht('Checkout'));
- } else {
- $label = phutil_tag_div('diffusion-clone-label', pht('Clone'));
+ } else {
+ foreach ($uris as $uri) {
+ if ($uri->getIsDisabled()) {
+ continue;
+ }
+
+ if ($uri->getEffectiveDisplayType() == $display_never) {
+ continue;
+ }
+
+ $view->addProperty(
+ $this->getCloneLabel($repository),
+ $this->renderCloneURI($repository, $uri));
}
-
- $view->addProperty(
- $label,
- $this->renderCloneURI($repository, $uri));
}
if (!$view->hasAnyProperties()) {

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 21:17 (11 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1021101
Default Alt Text
D25574.1734729445.diff (2 KB)

Event Timeline