
Sync 'next' with 'master'
Reviewed-by: Suwon Chae
@384e3594ad945e0a3ed64691c120f8b75c610402
--- app/models/PullRequest.java
+++ app/models/PullRequest.java
... | ... | @@ -149,7 +149,7 @@ |
149 | 149 |
joinColumns = @JoinColumn(name = "pull_request_id"), |
150 | 150 |
inverseJoinColumns = @JoinColumn(name = "user_id") |
151 | 151 |
) |
152 |
- public List<User> reviewers = new ArrayList<>(); |
|
152 |
+ public Set<User> reviewers = new HashSet<>(); |
|
153 | 153 |
|
154 | 154 |
@OneToMany(mappedBy = "pullRequest") |
155 | 155 |
public List<CommentThread> commentThreads = new ArrayList<>(); |
... | ... | @@ -999,7 +999,7 @@ |
999 | 999 |
} |
1000 | 1000 |
|
1001 | 1001 |
public void clearReviewers() { |
1002 |
- this.reviewers = new ArrayList<>(); |
|
1002 |
+ this.reviewers = new HashSet<>(); |
|
1003 | 1003 |
this.update(); |
1004 | 1004 |
} |
1005 | 1005 |
|
... | ... | @@ -1008,8 +1008,9 @@ |
1008 | 1008 |
} |
1009 | 1009 |
|
1010 | 1010 |
public void addReviewer(User user) { |
1011 |
- this.reviewers.add(user); |
|
1012 |
- this.update(); |
|
1011 |
+ if(this.reviewers.add(user)) { |
|
1012 |
+ this.update(); |
|
1013 |
+ } |
|
1013 | 1014 |
} |
1014 | 1015 |
|
1015 | 1016 |
public void removeReviewer(User user) { |
--- app/models/User.java
+++ app/models/User.java
... | ... | @@ -765,4 +765,24 @@ |
765 | 765 |
return name + "(" + loginId + ")"; |
766 | 766 |
} |
767 | 767 |
} |
768 |
+ |
|
769 |
+ @Override |
|
770 |
+ public boolean equals(Object o) { |
|
771 |
+ if(!(o instanceof User)) { |
|
772 |
+ return false; |
|
773 |
+ } |
|
774 |
+ if(o == this) { |
|
775 |
+ return true; |
|
776 |
+ } |
|
777 |
+ User user = (User) o; |
|
778 |
+ return this.id.equals(user.id) && this.loginId.equals(user.loginId); |
|
779 |
+ } |
|
780 |
+ |
|
781 |
+ @Override |
|
782 |
+ public int hashCode() { |
|
783 |
+ int result = super.hashCode(); |
|
784 |
+ result = result * 37 + (this.id != null ? this.id.hashCode() : 0); |
|
785 |
+ result = result * 37 + (this.loginId != null ? this.loginId.hashCode() : 0); |
|
786 |
+ return result; |
|
787 |
+ } |
|
768 | 788 |
} |
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?