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:
Edwin Kempin
2018-02-02 17:15:10 +01:00
parent 7229c9d50c
commit 827c755b75

View File

@@ -99,12 +99,16 @@ public class AccountResolver {
Matcher m = Pattern.compile("^.* \\(([1-9][0-9]*)\\)$").matcher(nameOrEmail);
if (m.matches()) {
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]*$")) {
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)) {