
History: fixed to use 'findByCommitterEmail'
@b5f9354d0cba510ae335f7729efbeb113575819c
--- app/models/User.java
+++ app/models/User.java
... | ... | @@ -213,22 +213,28 @@ |
213 | 213 |
} |
214 | 214 |
|
215 | 215 |
/** |
216 |
- * email로 사용자를 조회한다. |
|
217 | 216 |
* |
218 |
- * 사용자가 없으면 {@link #anonymous}객체에 email을 할당하고 반환한다. |
|
217 |
+ * Find a user by email account. |
|
218 |
+ * - find a user with a given email account or who has the email account as one of sub email accounts. |
|
219 |
+ * - If no user matched up with the given email account, then return the {@link #anonymous} |
|
220 |
+ * after setting the email account to the object. |
|
219 | 221 |
* |
220 | 222 |
* @param email |
221 | 223 |
* @return |
222 | 224 |
*/ |
223 | 225 |
public static User findByEmail(String email) { |
224 | 226 |
User user = find.where().eq("email", email).findUnique(); |
225 |
- if (user == null) { |
|
226 |
- anonymous.email = email; |
|
227 |
- return anonymous; |
|
228 |
- } |
|
229 |
- else { |
|
227 |
+ if (user != null) { |
|
230 | 228 |
return user; |
231 | 229 |
} |
230 |
+ |
|
231 |
+ Email subEmail = Email.findByEmail(email, true); |
|
232 |
+ if (subEmail != null) { |
|
233 |
+ return subEmail.user; |
|
234 |
+ } |
|
235 |
+ |
|
236 |
+ anonymous.email = email; |
|
237 |
+ return anonymous; |
|
232 | 238 |
} |
233 | 239 |
|
234 | 240 |
/** |
... | ... | @@ -569,26 +575,6 @@ |
569 | 575 |
public void removeEmail(Email email) { |
570 | 576 |
emails.remove(email); |
571 | 577 |
email.delete(); |
572 |
- } |
|
573 |
- |
|
574 |
- /** |
|
575 |
- * {@code committerEmail}에 해당하는 User를 찾아 반환한다. |
|
576 |
- * |
|
577 |
- * @param committerEmail |
|
578 |
- * @return |
|
579 |
- */ |
|
580 |
- public static User findByCommitterEmail(String committerEmail) { |
|
581 |
- User user = find.where().eq("email", committerEmail).findUnique(); |
|
582 |
- if (user != null) { |
|
583 |
- return user; |
|
584 |
- } |
|
585 |
- |
|
586 |
- Email email = Email.findByEmail(committerEmail, true); |
|
587 |
- if (email != null) { |
|
588 |
- return email.user; |
|
589 |
- } |
|
590 |
- |
|
591 |
- return anonymous; |
|
592 | 578 |
} |
593 | 579 |
|
594 | 580 |
public void visits(Project project) { |
--- app/playRepository/GitBranch.java
+++ app/playRepository/GitBranch.java
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 |
this.name = name; |
45 | 45 |
this.shortName = StringUtils.removeStart(name, Constants.R_HEADS); |
46 | 46 |
this.headCommit = headCommit; |
47 |
- this.user = User.findByCommitterEmail(headCommit.getCommitterEmail()); |
|
47 |
+ this.user = User.findByEmail(headCommit.getCommitterEmail()); |
|
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
public String getName() { |
--- app/playRepository/GitRepository.java
+++ app/playRepository/GitRepository.java
... | ... | @@ -1152,7 +1152,7 @@ |
1152 | 1152 |
if (personIdent == null) { |
1153 | 1153 |
return User.anonymous; |
1154 | 1154 |
} |
1155 |
- return User.findByCommitterEmail(personIdent.getEmailAddress()); |
|
1155 |
+ return User.findByEmail(personIdent.getEmailAddress()); |
|
1156 | 1156 |
} |
1157 | 1157 |
|
1158 | 1158 |
/** |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?