Page MenuHomePhabricator

D20828.id.diff
No OneTemporary

D20828.id.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2268,6 +2268,7 @@
'PhabricatorAuthChallengeStatusController' => 'applications/auth/controller/mfa/PhabricatorAuthChallengeStatusController.php',
'PhabricatorAuthChallengeUpdate' => 'applications/auth/view/PhabricatorAuthChallengeUpdate.php',
'PhabricatorAuthChangePasswordAction' => 'applications/auth/action/PhabricatorAuthChangePasswordAction.php',
+ 'PhabricatorAuthChangeUsernameMessageType' => 'applications/auth/message/PhabricatorAuthChangeUsernameMessageType.php',
'PhabricatorAuthConduitAPIMethod' => 'applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php',
'PhabricatorAuthConduitTokenRevoker' => 'applications/auth/revoker/PhabricatorAuthConduitTokenRevoker.php',
'PhabricatorAuthConfirmLinkController' => 'applications/auth/controller/PhabricatorAuthConfirmLinkController.php',
@@ -8455,6 +8456,7 @@
'PhabricatorAuthChallengeStatusController' => 'PhabricatorAuthController',
'PhabricatorAuthChallengeUpdate' => 'Phobject',
'PhabricatorAuthChangePasswordAction' => 'PhabricatorSystemAction',
+ 'PhabricatorAuthChangeUsernameMessageType' => 'PhabricatorAuthMessageType',
'PhabricatorAuthConduitAPIMethod' => 'ConduitAPIMethod',
'PhabricatorAuthConduitTokenRevoker' => 'PhabricatorAuthRevoker',
'PhabricatorAuthConfirmLinkController' => 'PhabricatorAuthController',
diff --git a/src/applications/auth/message/PhabricatorAuthChangeUsernameMessageType.php b/src/applications/auth/message/PhabricatorAuthChangeUsernameMessageType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/auth/message/PhabricatorAuthChangeUsernameMessageType.php
@@ -0,0 +1,29 @@
+<?php
+
+final class PhabricatorAuthChangeUsernameMessageType
+ extends PhabricatorAuthMessageType {
+
+ const MESSAGEKEY = 'user.edit.username';
+
+ public function getDisplayName() {
+ return pht('Username Change Instructions');
+ }
+
+ public function getShortDescription() {
+ return pht(
+ 'Guidance in the "Change Username" dialog for requesting a '.
+ 'username change.');
+ }
+
+ public function getFullDescription() {
+ return pht(
+ 'When users click the "Change Username" action on their profile pages '.
+ 'but do not have the required permissions, they will be presented with '.
+ 'a message explaining that they are not authorized to make the edit.'.
+ "\n\n".
+ 'You can optionally provide additional instructions here to help users '.
+ 'request a username change, if there is someone specific they should '.
+ 'contact or a particular workflow they should use.');
+ }
+
+}
diff --git a/src/applications/people/controller/PhabricatorPeopleRenameController.php b/src/applications/people/controller/PhabricatorPeopleRenameController.php
--- a/src/applications/people/controller/PhabricatorPeopleRenameController.php
+++ b/src/applications/people/controller/PhabricatorPeopleRenameController.php
@@ -23,13 +23,22 @@
$done_uri = $this->getApplicationURI("manage/{$id}/");
if (!$viewer->getIsAdmin()) {
- return $this->newDialog()
+ $dialog = $this->newDialog()
->setTitle(pht('Change Username'))
->appendParagraph(
pht(
'You can not change usernames because you are not an '.
'administrator. Only administrators can change usernames.'))
->addCancelButton($done_uri, pht('Okay'));
+
+ $message_body = PhabricatorAuthMessage::loadMessageText(
+ $viewer,
+ PhabricatorAuthChangeUsernameMessageType::MESSAGEKEY);
+ if (strlen($message_body)) {
+ $dialog->appendRemarkup($message_body);
+ }
+
+ return $dialog;
}
$validation_exception = null;

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 4, 8:01 AM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7709952
Default Alt Text
D20828.id.diff (3 KB)

Event Timeline