Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2628709
D25574.1732034401.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
D25574.1732034401.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 16:40 (21 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
978048
Default Alt Text
D25574.1732034401.diff (2 KB)
Attached To
Mode
D25574: Expose only canonical Clone URI for external repo and Differential uninstalled
Attached
Detach File
Event Timeline
Log In to Comment