AccountResolver: Inside of map methods use the id from the provided account
This should be always the same ID as 'id' but like this it's more readable. Change-Id: Ie7eed61baad09510ce98395ca1f5c672f08ea2b3 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -99,12 +99,16 @@ public class AccountResolver {
|
|||||||
Matcher m = Pattern.compile("^.* \\(([1-9][0-9]*)\\)$").matcher(nameOrEmail);
|
Matcher m = Pattern.compile("^.* \\(([1-9][0-9]*)\\)$").matcher(nameOrEmail);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
Account.Id id = Account.Id.parse(m.group(1));
|
Account.Id id = Account.Id.parse(m.group(1));
|
||||||
return Streams.stream(accounts.get(id)).map(a -> id).collect(toImmutableSet());
|
return Streams.stream(accounts.get(id))
|
||||||
|
.map(a -> a.getAccount().getId())
|
||||||
|
.collect(toImmutableSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nameOrEmail.matches("^[1-9][0-9]*$")) {
|
if (nameOrEmail.matches("^[1-9][0-9]*$")) {
|
||||||
Account.Id id = Account.Id.parse(nameOrEmail);
|
Account.Id id = Account.Id.parse(nameOrEmail);
|
||||||
return Streams.stream(accounts.get(id)).map(a -> id).collect(toImmutableSet());
|
return Streams.stream(accounts.get(id))
|
||||||
|
.map(a -> a.getAccount().getId())
|
||||||
|
.collect(toImmutableSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nameOrEmail.matches(Account.USER_NAME_PATTERN)) {
|
if (nameOrEmail.matches(Account.USER_NAME_PATTERN)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user