@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.

Personal Settings: Make API Token text field readonly

Summary:
In your personal settings, when displaying an API Token, that `AphrontFormTextControl` text field is editable. That is confusing as you cannot edit the token.

Thus allow to `setReadOnly()` on `AphrontFormTextControl` by copying the existing implementation from `AphrontFormTextAreaControl`, and use that in `PhabricatorConduitTokenEditController`.

Refs T16177
Closes T16178

Test Plan:
* Go to http://phorge.localhost/settings/panel/apitokens/
* Click "Generate Token"
* In the resulting text field displaying the token, try to edit the text
* Go back to overview at http://phorge.localhost/settings/panel/apitokens/, click on an existing token to open it
* In the resulting text field displaying the token, try to edit the text

Reviewers: O1 Blessed Committers, mainframe98, valerio.bozzolan

Reviewed By: O1 Blessed Committers, mainframe98, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16178, T16177

Differential Revision: https://we.phorge.it/D26195

+12
+1
src/applications/conduit/controller/PhabricatorConduitTokenEditController.php
··· 93 93 ->appendChild( 94 94 id(new AphrontFormTextControl()) 95 95 ->setLabel(pht('Token')) 96 + ->setReadOnly(true) 96 97 ->setValue($token->getToken())); 97 98 98 99 $dialog->appendForm($form);
+11
src/view/form/control/AphrontFormTextControl.php
··· 6 6 private $sigil; 7 7 private $placeholder; 8 8 private $autofocus; 9 + private $readOnly; 9 10 10 11 public function setDisableAutocomplete($disable) { 11 12 $this->disableAutocomplete = $disable; ··· 43 44 return $this; 44 45 } 45 46 47 + public function setReadOnly($read_only) { 48 + $this->readOnly = $read_only; 49 + return $this; 50 + } 51 + 52 + protected function getReadOnly() { 53 + return $this->readOnly; 54 + } 55 + 46 56 protected function getCustomControlClass() { 47 57 return 'aphront-form-control-text'; 48 58 } ··· 55 65 'name' => $this->getName(), 56 66 'value' => $this->getValue(), 57 67 'disabled' => $this->getDisabled() ? 'disabled' : null, 68 + 'readonly' => $this->getReadOnly() ? 'readonly' : null, 58 69 'autocomplete' => $this->getDisableAutocomplete() ? 'off' : null, 59 70 'id' => $this->getID(), 60 71 'sigil' => $this->getSigil(),