mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] users with different e-mails are not equal
This commit is contained in:
@@ -23,8 +23,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Note: users are considered equal if they have the same name, even if the e-mail is different.
|
||||
* Note: users are considered equal if they have the same name and email. Emails are converted to lower case in constructor.
|
||||
*/
|
||||
public class VcsUserImpl implements VcsUser {
|
||||
@NotNull private static final Pattern NAME_WITH_DOT = Pattern.compile("(\\w*)\\.(\\w*)");
|
||||
@@ -35,7 +37,7 @@ public class VcsUserImpl implements VcsUser {
|
||||
|
||||
public VcsUserImpl(@NotNull String name, @NotNull String email) {
|
||||
myName = name;
|
||||
myEmail = email;
|
||||
myEmail = email.toLowerCase();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -58,13 +60,14 @@ public class VcsUserImpl implements VcsUser {
|
||||
VcsUserImpl user = (VcsUserImpl)o;
|
||||
|
||||
if (!myName.equals(user.myName)) return false;
|
||||
if (!myEmail.equals(user.myEmail)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myName.hashCode();
|
||||
return Objects.hash(myName, myEmail);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user