Hide duplicate emails in the contact panel
This can happen if the user has multiple OpenID strings from the same account provider. Google Accounts for example gives a unique string for each hostname the site is accessed through. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -36,7 +36,9 @@ import com.google.gwtjsonrpc.client.VoidResult;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
class ContactPanel extends Composite {
|
class ContactPanel extends Composite {
|
||||||
private final AccountSettings parentScreen;
|
private final AccountSettings parentScreen;
|
||||||
@@ -164,13 +166,14 @@ class ContactPanel extends Composite {
|
|||||||
if (!isAttached()) {
|
if (!isAttached()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final List<String> addrs = new ArrayList<String>();
|
final Set<String> emails = new HashSet<String>();
|
||||||
for (final AccountExternalId i : result) {
|
for (final AccountExternalId i : result) {
|
||||||
if (i.getEmailAddress() != null
|
if (i.getEmailAddress() != null
|
||||||
&& i.getEmailAddress().length() > 0) {
|
&& i.getEmailAddress().length() > 0) {
|
||||||
addrs.add(i.getEmailAddress());
|
emails.add(i.getEmailAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final List<String> addrs = new ArrayList<String>(emails);
|
||||||
Collections.sort(addrs);
|
Collections.sort(addrs);
|
||||||
for (String s : addrs) {
|
for (String s : addrs) {
|
||||||
emailPick.addItem(s);
|
emailPick.addItem(s);
|
||||||
|
Reference in New Issue
Block a user