mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Match usernames in any case in commit message object lists (CC, Reviewers, etc.)
Summary: Allow entry of "CC: alincoln" to match user "ALincoln". Put both variations in the map and try the exact case version first since we'll also match email addresses and mailables, and theoretically some mailable might have the same name as a user, as we're effectively abandoning restriction of which characters can appear in usernames. Test Plan: Created a local revision with a reviewer in CrAzY CaPs. Reviewers: jungejason, btrahan Reviewed By: jungejason CC: aran, jungejason Maniphest Tasks: T697 Differential Revision: 1255
This commit is contained in:
parent
7075222b4b
commit
bd3c2355e8
1 changed files with 14 additions and 2 deletions
|
@ -580,7 +580,15 @@ abstract class DifferentialFieldSpecification {
|
||||||
'(username IN (%Ls)) OR (email IN (%Ls))',
|
'(username IN (%Ls)) OR (email IN (%Ls))',
|
||||||
$value,
|
$value,
|
||||||
$value);
|
$value);
|
||||||
$object_map += mpull($users, 'getPHID', 'getUsername');
|
$user_map = mpull($users, 'getPHID', 'getUsername');
|
||||||
|
foreach ($user_map as $username => $phid) {
|
||||||
|
// Usernames may have uppercase letters in them. Put both names in the
|
||||||
|
// map so we can try the original case first, so that username *always*
|
||||||
|
// works in weird edge cases where some other mailable object collides.
|
||||||
|
$object_map[$username] = $phid;
|
||||||
|
$object_map[strtolower($username)] = $phid;
|
||||||
|
}
|
||||||
|
|
||||||
$object_map += mpull($users, 'getPHID', 'getEmail');
|
$object_map += mpull($users, 'getPHID', 'getEmail');
|
||||||
|
|
||||||
if ($include_mailables) {
|
if ($include_mailables) {
|
||||||
|
@ -596,7 +604,11 @@ abstract class DifferentialFieldSpecification {
|
||||||
$results = array();
|
$results = array();
|
||||||
foreach ($value as $name) {
|
foreach ($value as $name) {
|
||||||
if (empty($object_map[$name])) {
|
if (empty($object_map[$name])) {
|
||||||
$invalid[] = $name;
|
if (empty($object_map[strtolower($name)])) {
|
||||||
|
$invalid[] = $name;
|
||||||
|
} else {
|
||||||
|
$results[] = $object_map[strtolower($name)];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$results[] = $object_map[$name];
|
$results[] = $object_map[$name];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue