@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve errors associated with adding new login providers

Summary:
Ref T1536.

- When users try to add a one-of provider which already exists, give them a better error (a dialog explaining what's up with reasonable choices).
- Disable such providers and label why they're disabled on the "new provider" screen.

Test Plan:
{F47012}

{F47013}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Maniphest Tasks: T1536

Differential Revision: https://secure.phabricator.com/D6256

+106 -51
+45 -45
src/__celerity_resource_map__.php
··· 814 814 ), 815 815 'aphront-form-view-css' => 816 816 array( 817 - 'uri' => '/res/d541ef47/rsrc/css/aphront/form-view.css', 817 + 'uri' => '/res/068dd7ed/rsrc/css/aphront/form-view.css', 818 818 'type' => 'css', 819 819 'requires' => 820 820 array( ··· 4057 4057 ), array( 4058 4058 'packages' => 4059 4059 array( 4060 - 'c85c10a8' => 4060 + 'f0f013fd' => 4061 4061 array( 4062 4062 'name' => 'core.pkg.css', 4063 4063 'symbols' => ··· 4105 4105 40 => 'phabricator-property-list-view-css', 4106 4106 41 => 'phabricator-tag-view-css', 4107 4107 ), 4108 - 'uri' => '/res/pkg/c85c10a8/core.pkg.css', 4108 + 'uri' => '/res/pkg/f0f013fd/core.pkg.css', 4109 4109 'type' => 'css', 4110 4110 ), 4111 4111 'f2ad0683' => ··· 4299 4299 'reverse' => 4300 4300 array( 4301 4301 'aphront-attached-file-view-css' => 'adc3c36d', 4302 - 'aphront-dialog-view-css' => 'c85c10a8', 4303 - 'aphront-error-view-css' => 'c85c10a8', 4304 - 'aphront-form-view-css' => 'c85c10a8', 4305 - 'aphront-list-filter-view-css' => 'c85c10a8', 4306 - 'aphront-pager-view-css' => 'c85c10a8', 4307 - 'aphront-panel-view-css' => 'c85c10a8', 4308 - 'aphront-table-view-css' => 'c85c10a8', 4309 - 'aphront-tokenizer-control-css' => 'c85c10a8', 4310 - 'aphront-tooltip-css' => 'c85c10a8', 4311 - 'aphront-typeahead-control-css' => 'c85c10a8', 4302 + 'aphront-dialog-view-css' => 'f0f013fd', 4303 + 'aphront-error-view-css' => 'f0f013fd', 4304 + 'aphront-form-view-css' => 'f0f013fd', 4305 + 'aphront-list-filter-view-css' => 'f0f013fd', 4306 + 'aphront-pager-view-css' => 'f0f013fd', 4307 + 'aphront-panel-view-css' => 'f0f013fd', 4308 + 'aphront-table-view-css' => 'f0f013fd', 4309 + 'aphront-tokenizer-control-css' => 'f0f013fd', 4310 + 'aphront-tooltip-css' => 'f0f013fd', 4311 + 'aphront-typeahead-control-css' => 'f0f013fd', 4312 4312 'differential-changeset-view-css' => 'dd27a69b', 4313 4313 'differential-core-view-css' => 'dd27a69b', 4314 4314 'differential-inline-comment-editor' => '9488bb69', ··· 4322 4322 'differential-table-of-contents-css' => 'dd27a69b', 4323 4323 'diffusion-commit-view-css' => 'c8ce2d88', 4324 4324 'diffusion-icons-css' => 'c8ce2d88', 4325 - 'global-drag-and-drop-css' => 'c85c10a8', 4325 + 'global-drag-and-drop-css' => 'f0f013fd', 4326 4326 'inline-comment-summary-css' => 'dd27a69b', 4327 4327 'javelin-aphlict' => 'f2ad0683', 4328 4328 'javelin-behavior' => 'a9f14d76', ··· 4396 4396 'javelin-util' => 'a9f14d76', 4397 4397 'javelin-vector' => 'a9f14d76', 4398 4398 'javelin-workflow' => 'a9f14d76', 4399 - 'lightbox-attachment-css' => 'c85c10a8', 4399 + 'lightbox-attachment-css' => 'f0f013fd', 4400 4400 'maniphest-task-summary-css' => 'adc3c36d', 4401 4401 'maniphest-transaction-detail-css' => 'adc3c36d', 4402 - 'phabricator-action-list-view-css' => 'c85c10a8', 4403 - 'phabricator-application-launch-view-css' => 'c85c10a8', 4402 + 'phabricator-action-list-view-css' => 'f0f013fd', 4403 + 'phabricator-application-launch-view-css' => 'f0f013fd', 4404 4404 'phabricator-busy' => 'f2ad0683', 4405 4405 'phabricator-content-source-view-css' => 'dd27a69b', 4406 - 'phabricator-core-css' => 'c85c10a8', 4407 - 'phabricator-crumbs-view-css' => 'c85c10a8', 4406 + 'phabricator-core-css' => 'f0f013fd', 4407 + 'phabricator-crumbs-view-css' => 'f0f013fd', 4408 4408 'phabricator-drag-and-drop-file-upload' => '9488bb69', 4409 4409 'phabricator-dropdown-menu' => 'f2ad0683', 4410 4410 'phabricator-file-upload' => 'f2ad0683', 4411 - 'phabricator-filetree-view-css' => 'c85c10a8', 4412 - 'phabricator-flag-css' => 'c85c10a8', 4413 - 'phabricator-form-view-css' => 'c85c10a8', 4414 - 'phabricator-header-view-css' => 'c85c10a8', 4411 + 'phabricator-filetree-view-css' => 'f0f013fd', 4412 + 'phabricator-flag-css' => 'f0f013fd', 4413 + 'phabricator-form-view-css' => 'f0f013fd', 4414 + 'phabricator-header-view-css' => 'f0f013fd', 4415 4415 'phabricator-hovercard' => 'f2ad0683', 4416 - 'phabricator-jump-nav' => 'c85c10a8', 4416 + 'phabricator-jump-nav' => 'f0f013fd', 4417 4417 'phabricator-keyboard-shortcut' => 'f2ad0683', 4418 4418 'phabricator-keyboard-shortcut-manager' => 'f2ad0683', 4419 - 'phabricator-main-menu-view' => 'c85c10a8', 4419 + 'phabricator-main-menu-view' => 'f0f013fd', 4420 4420 'phabricator-menu-item' => 'f2ad0683', 4421 - 'phabricator-nav-view-css' => 'c85c10a8', 4421 + 'phabricator-nav-view-css' => 'f0f013fd', 4422 4422 'phabricator-notification' => 'f2ad0683', 4423 - 'phabricator-notification-css' => 'c85c10a8', 4424 - 'phabricator-notification-menu-css' => 'c85c10a8', 4425 - 'phabricator-object-item-list-view-css' => 'c85c10a8', 4423 + 'phabricator-notification-css' => 'f0f013fd', 4424 + 'phabricator-notification-menu-css' => 'f0f013fd', 4425 + 'phabricator-object-item-list-view-css' => 'f0f013fd', 4426 4426 'phabricator-object-selector-css' => 'dd27a69b', 4427 4427 'phabricator-phtize' => 'f2ad0683', 4428 4428 'phabricator-prefab' => 'f2ad0683', 4429 4429 'phabricator-project-tag-css' => 'adc3c36d', 4430 - 'phabricator-property-list-view-css' => 'c85c10a8', 4431 - 'phabricator-remarkup-css' => 'c85c10a8', 4430 + 'phabricator-property-list-view-css' => 'f0f013fd', 4431 + 'phabricator-remarkup-css' => 'f0f013fd', 4432 4432 'phabricator-shaped-request' => '9488bb69', 4433 - 'phabricator-side-menu-view-css' => 'c85c10a8', 4434 - 'phabricator-standard-page-view' => 'c85c10a8', 4435 - 'phabricator-tag-view-css' => 'c85c10a8', 4433 + 'phabricator-side-menu-view-css' => 'f0f013fd', 4434 + 'phabricator-standard-page-view' => 'f0f013fd', 4435 + 'phabricator-tag-view-css' => 'f0f013fd', 4436 4436 'phabricator-textareautils' => 'f2ad0683', 4437 4437 'phabricator-tooltip' => 'f2ad0683', 4438 - 'phabricator-transaction-view-css' => 'c85c10a8', 4439 - 'phabricator-zindex-css' => 'c85c10a8', 4440 - 'phui-button-css' => 'c85c10a8', 4441 - 'phui-form-css' => 'c85c10a8', 4442 - 'phui-icon-view-css' => 'c85c10a8', 4443 - 'phui-spacing-css' => 'c85c10a8', 4444 - 'sprite-apps-large-css' => 'c85c10a8', 4445 - 'sprite-gradient-css' => 'c85c10a8', 4446 - 'sprite-icons-css' => 'c85c10a8', 4447 - 'sprite-menu-css' => 'c85c10a8', 4448 - 'syntax-highlighting-css' => 'c85c10a8', 4438 + 'phabricator-transaction-view-css' => 'f0f013fd', 4439 + 'phabricator-zindex-css' => 'f0f013fd', 4440 + 'phui-button-css' => 'f0f013fd', 4441 + 'phui-form-css' => 'f0f013fd', 4442 + 'phui-icon-view-css' => 'f0f013fd', 4443 + 'phui-spacing-css' => 'f0f013fd', 4444 + 'sprite-apps-large-css' => 'f0f013fd', 4445 + 'sprite-gradient-css' => 'f0f013fd', 4446 + 'sprite-icons-css' => 'f0f013fd', 4447 + 'sprite-menu-css' => 'f0f013fd', 4448 + 'syntax-highlighting-css' => 'f0f013fd', 4449 4449 ), 4450 4450 ));
+16 -2
src/applications/auth/controller/config/PhabricatorAuthEditController.php
··· 56 56 ->execute(); 57 57 58 58 if ($configs) { 59 - // TODO: We could link to the other config's edit interface here. 60 - throw new Exception("This provider is already configured!"); 59 + $id = head($configs)->getID(); 60 + $dialog = id(new AphrontDialogView()) 61 + ->setUser($viewer) 62 + ->setMethod('GET') 63 + ->setSubmitURI($this->getApplicationURI('config/edit/'.$id.'/')) 64 + ->setTitle(pht('Provider Already Configured')) 65 + ->appendChild( 66 + pht( 67 + 'This provider ("%s") already exists, and you can not add more '. 68 + 'than one instance of it. You can edit the existing provider, '. 69 + 'or you can choose a different provider.', 70 + $provider->getProviderName())) 71 + ->addCancelButton($this->getApplicationURI('config/new/')) 72 + ->addSubmitButton(pht('Edit Existing Provider')); 73 + 74 + return id(new AphrontDialogResponse())->setDialog($dialog); 61 75 } 62 76 63 77 $config = $provider->getDefaultProviderConfig();
+20 -1
src/applications/auth/controller/config/PhabricatorAuthNewController.php
··· 46 46 ->setName('provider') 47 47 ->setError($e_provider); 48 48 49 + $configured = PhabricatorAuthProvider::getAllProviders(); 50 + $configured_classes = array(); 51 + foreach ($configured as $configured_provider) { 52 + $configured_classes[get_class($configured_provider)] = true; 53 + } 54 + 55 + // Sort providers by login order, and move disabled providers to the 56 + // bottom. 49 57 $providers = msort($providers, 'getLoginOrder'); 58 + $providers = array_diff_key($providers, $configured_classes) + $providers; 59 + 50 60 foreach ($providers as $provider) { 61 + if (isset($configured_classes[get_class($provider)])) { 62 + $disabled = true; 63 + $description = pht('This provider is already configured.'); 64 + } else { 65 + $disabled = false; 66 + $description = $provider->getDescriptionForCreate(); 67 + } 51 68 $options->addButton( 52 69 get_class($provider), 53 70 $provider->getNameForCreate(), 54 - $provider->getDescriptionForCreate()); 71 + $description, 72 + $disabled ? 'disabled' : null, 73 + $disabled); 55 74 } 56 75 57 76 $form = id(new AphrontFormView())
+8 -1
src/view/AphrontDialogView.php
··· 14 14 private $headerColor = PhabricatorActionHeaderView::HEADER_DARK_GREY; 15 15 private $footers = array(); 16 16 private $isStandalone; 17 + private $method = 'POST'; 18 + 19 + 20 + public function setMethod($method) { 21 + $this->method = $method; 22 + return $this; 23 + } 17 24 18 25 public function setIsStandalone($is_standalone) { 19 26 $this->isStandalone = $is_standalone; ··· 159 166 160 167 $form_attributes = array( 161 168 'action' => $this->submitURI, 162 - 'method' => 'post', 169 + 'method' => $this->method, 163 170 'id' => $this->formID, 164 171 ); 165 172
+10 -2
src/view/form/control/AphrontFormRadioButtonControl.php
··· 4 4 5 5 private $buttons = array(); 6 6 7 - public function addButton($value, $label, $caption, $class = null) { 7 + public function addButton( 8 + $value, 9 + $label, 10 + $caption, 11 + $class = null, 12 + $disabled = false) { 8 13 $this->buttons[] = array( 9 14 'value' => $value, 10 15 'label' => $label, 11 16 'caption' => $caption, 12 17 'class' => $class, 18 + 'disabled' => $disabled, 13 19 ); 14 20 return $this; 15 21 } ··· 32 38 'checked' => ($button['value'] == $this->getValue()) 33 39 ? 'checked' 34 40 : null, 35 - 'disabled' => $this->getDisabled() ? 'disabled' : null, 41 + 'disabled' => ($this->getDisabled() || $button['disabled']) 42 + ? 'disabled' 43 + : null, 36 44 )); 37 45 $label = phutil_tag( 38 46 'label',
+7
webroot/rsrc/css/aphront/form-view.css
··· 190 190 color: #222222; 191 191 } 192 192 193 + 193 194 table.aphront-form-control-checkbox-layout th { 194 195 padding-top: 2px; 195 196 padding-left: 8px; ··· 202 203 .aphront-form-control-checkbox-layout td input { 203 204 margin-top: 4px; 204 205 width: auto; 206 + } 207 + 208 + 209 + .aphront-form-control-radio-layout label.disabled, 210 + .aphront-form-control-checkbox-layout label.disabled { 211 + color: #777777; 205 212 } 206 213 207 214 .aphront-form-radio-caption {