Cleanup: Rename robotClassifier to serviceUserClassifier

Change-Id: I7ce7d8622b55787d2cdd5e0274d4f1ebac9744b3
This commit is contained in:
Gal Paikin
2020-08-13 12:57:49 +03:00
parent 6f27cd41ad
commit 096bbd1854
3 changed files with 15 additions and 15 deletions

View File

@@ -121,7 +121,7 @@ public class ChangeUpdate extends AbstractChangeUpdate {
private final ChangeDraftUpdate.Factory draftUpdateFactory;
private final RobotCommentUpdate.Factory robotCommentUpdateFactory;
private final DeleteCommentRewriter.Factory deleteCommentRewriterFactory;
private final ServiceUserClassifier robotClassifier;
private final ServiceUserClassifier serviceUserClassifier;
private final Table<String, Account.Id, Optional<Short>> approvals;
private final Map<Account.Id, ReviewerStateInternal> reviewers = new LinkedHashMap<>();
@@ -167,7 +167,7 @@ public class ChangeUpdate extends AbstractChangeUpdate {
RobotCommentUpdate.Factory robotCommentUpdateFactory,
DeleteCommentRewriter.Factory deleteCommentRewriterFactory,
ProjectCache projectCache,
ServiceUserClassifier robotClassifier,
ServiceUserClassifier serviceUserClassifier,
@Assisted ChangeNotes notes,
@Assisted CurrentUser user,
@Assisted Date when,
@@ -178,7 +178,7 @@ public class ChangeUpdate extends AbstractChangeUpdate {
draftUpdateFactory,
robotCommentUpdateFactory,
deleteCommentRewriterFactory,
robotClassifier,
serviceUserClassifier,
notes,
user,
when,
@@ -202,7 +202,7 @@ public class ChangeUpdate extends AbstractChangeUpdate {
ChangeDraftUpdate.Factory draftUpdateFactory,
RobotCommentUpdate.Factory robotCommentUpdateFactory,
DeleteCommentRewriter.Factory deleteCommentRewriterFactory,
ServiceUserClassifier robotClassifier,
ServiceUserClassifier serviceUserClassifier,
@Assisted ChangeNotes notes,
@Assisted CurrentUser user,
@Assisted Date when,
@@ -213,7 +213,7 @@ public class ChangeUpdate extends AbstractChangeUpdate {
this.draftUpdateFactory = draftUpdateFactory;
this.robotCommentUpdateFactory = robotCommentUpdateFactory;
this.deleteCommentRewriterFactory = deleteCommentRewriterFactory;
this.robotClassifier = robotClassifier;
this.serviceUserClassifier = serviceUserClassifier;
this.approvals = approvals(labelNameComparator);
}
@@ -833,7 +833,7 @@ public class ChangeUpdate extends AbstractChangeUpdate {
}
if (attentionSetUpdate.operation() == AttentionSetUpdate.Operation.ADD
&& robotClassifier.isServiceUser(attentionSetUpdate.account())) {
&& serviceUserClassifier.isServiceUser(attentionSetUpdate.account())) {
// Skip adding robots to the attention set.
continue;
}

View File

@@ -48,7 +48,7 @@ public class AddToAttentionSet
private final AccountLoader.Factory accountLoaderFactory;
private final PermissionBackend permissionBackend;
private final NotifyResolver notifyResolver;
private final ServiceUserClassifier robotClassifier;
private final ServiceUserClassifier serviceUserClassifier;
@Inject
AddToAttentionSet(
@@ -58,14 +58,14 @@ public class AddToAttentionSet
AccountLoader.Factory accountLoaderFactory,
PermissionBackend permissionBackend,
NotifyResolver notifyResolver,
ServiceUserClassifier robotClassifier) {
ServiceUserClassifier serviceUserClassifier) {
this.updateFactory = updateFactory;
this.accountResolver = accountResolver;
this.opFactory = opFactory;
this.accountLoaderFactory = accountLoaderFactory;
this.permissionBackend = permissionBackend;
this.notifyResolver = notifyResolver;
this.robotClassifier = robotClassifier;
this.serviceUserClassifier = serviceUserClassifier;
}
@Override
@@ -74,7 +74,7 @@ public class AddToAttentionSet
AttentionSetUtil.validateInput(input);
Account.Id attentionUserId = accountResolver.resolve(input.user).asUnique().account().id();
if (robotClassifier.isServiceUser(attentionUserId)) {
if (serviceUserClassifier.isServiceUser(attentionUserId)) {
throw new BadRequestException(
String.format(
"%s is a robot, and robots can't be added to the attention set.", input.user));

View File

@@ -56,7 +56,7 @@ public class ReplyAttentionSetUpdates {
private final RemoveFromAttentionSetOp.Factory removeFromAttentionSetOpFactory;
private final ApprovalsUtil approvalsUtil;
private final AccountResolver accountResolver;
private final ServiceUserClassifier robotClassifier;
private final ServiceUserClassifier serviceUserClassifier;
@Inject
ReplyAttentionSetUpdates(
@@ -65,13 +65,13 @@ public class ReplyAttentionSetUpdates {
RemoveFromAttentionSetOp.Factory removeFromAttentionSetOpFactory,
ApprovalsUtil approvalsUtil,
AccountResolver accountResolver,
ServiceUserClassifier robotClassifier) {
ServiceUserClassifier serviceUserClassifier) {
this.permissionBackend = permissionBackend;
this.addToAttentionSetOpFactory = addToAttentionSetOpFactory;
this.removeFromAttentionSetOpFactory = removeFromAttentionSetOpFactory;
this.approvalsUtil = approvalsUtil;
this.accountResolver = accountResolver;
this.robotClassifier = robotClassifier;
this.serviceUserClassifier = serviceUserClassifier;
}
/** Adjusts the attention set but only based on the automatic rules. */
@@ -83,7 +83,7 @@ public class ReplyAttentionSetUpdates {
Account.Id currentUser)
throws IOException, ConfigInvalidException, PermissionBackendException,
UnprocessableEntityException {
if (robotClassifier.isServiceUser(currentUser)) {
if (serviceUserClassifier.isServiceUser(currentUser)) {
return;
}
Set<Account.Id> potentiallyRemovedReviewerIds = new HashSet<>();
@@ -120,7 +120,7 @@ public class ReplyAttentionSetUpdates {
bu.addOp(changeNotes.getChangeId(), new AttentionSetUnchangedOp());
return;
}
if (robotClassifier.isServiceUser(currentUser)) {
if (serviceUserClassifier.isServiceUser(currentUser)) {
botsWithNegativeLabelsAddOwnerAndUploader(bu, changeNotes, input);
robotCommentAddsOwnerAndUploader(bu, changeNotes, input);
return;