Page MenuHomePhabricator

D20890.diff
No OneTemporary

D20890.diff

diff --git a/src/applications/people/xaction/PhabricatorUserUsernameTransaction.php b/src/applications/people/xaction/PhabricatorUserUsernameTransaction.php
--- a/src/applications/people/xaction/PhabricatorUserUsernameTransaction.php
+++ b/src/applications/people/xaction/PhabricatorUserUsernameTransaction.php
@@ -71,21 +71,30 @@
}
if (!strlen($new)) {
- $errors[] = $this->newRequiredError(
- pht('New username is required.'), $xaction);
+ $errors[] = $this->newInvalidError(
+ pht('New username is required.'),
+ $xaction);
} else if (!PhabricatorUser::validateUsername($new)) {
$errors[] = $this->newInvalidError(
- PhabricatorUser::describeValidUsername(), $xaction);
+ PhabricatorUser::describeValidUsername(),
+ $xaction);
}
$user = id(new PhabricatorPeopleQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withUsernames(array($new))
->executeOne();
-
if ($user) {
- $errors[] = $this->newInvalidError(
- pht('Another user already has that username.'), $xaction);
+ // See T13446. We may be changing the letter case of a username, which
+ // is a perfectly fine edit.
+ $is_self = ($user->getPHID() === $object->getPHID());
+ if (!$is_self) {
+ $errors[] = $this->newInvalidError(
+ pht(
+ 'Another user already has the username "%s".',
+ $new),
+ $xaction);
+ }
}
}

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 7:20 AM (4 h, 34 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6930523
Default Alt Text
D20890.diff (1 KB)

Event Timeline