ReviewersResolver: Emit a warning to the log when account is inactive
If an account is inactive it cannot be added as reviewer. Emit a warning
to the log so that the admin is aware of inactive user being configured
as a reviewer.
Change-Id: I5ba11e478b6bbeea1ef9e09efcb937173d14f815
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java
index b1697bf..95c8316 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java
@@ -113,11 +113,18 @@
String accountName) {
try {
Account account = accountResolver.find(reviewDb, accountName);
- if (account != null && account.isActive()) {
- if (uploader == null || uploader._accountId != account.getId().get()) {
- reviewers.add(account.getId());
+ if (account != null) {
+ if (account.isActive()) {
+ if (uploader == null || uploader._accountId != account.getId().get()) {
+ reviewers.add(account.getId());
+ }
+ return true;
}
- return true;
+ log.warn(
+ "For the change {} of project {}: account {} is inactive.",
+ changeNumber,
+ project,
+ accountName);
}
} catch (OrmException e) {
// If the account doesn't exist, find() will return null. We only