Merge "Trim assignees"

This commit is contained in:
David Pursehouse
2016-11-30 12:21:35 +00:00
committed by Gerrit Code Review
2 changed files with 4 additions and 3 deletions

View File

@@ -113,6 +113,8 @@ public class Assignee extends Composite {
if (currentAssignee != null) { if (currentAssignee != null) {
suggestBox.setText(FormatUtil.nameEmail(currentAssignee)); suggestBox.setText(FormatUtil.nameEmail(currentAssignee));
suggestBox.selectAll(); suggestBox.selectAll();
} else {
suggestBox.setText("");
} }
} }
@@ -137,7 +139,7 @@ public class Assignee extends Composite {
} }
private void editAssignee(final String assignee) { private void editAssignee(final String assignee) {
if (assignee.isEmpty()) { if (assignee.trim().isEmpty()) {
ChangeApi.deleteAssignee(changeId.get(), ChangeApi.deleteAssignee(changeId.get(),
new GerritCallback<AccountInfo>() { new GerritCallback<AccountInfo>() {
@Override @Override

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.server.change; package com.google.gerrit.server.change;
import com.google.common.base.Strings;
import com.google.gerrit.common.TimeUtil; import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.extensions.api.changes.AddReviewerInput; import com.google.gerrit.extensions.api.changes.AddReviewerInput;
import com.google.gerrit.extensions.api.changes.AssigneeInput; import com.google.gerrit.extensions.api.changes.AssigneeInput;
@@ -65,7 +64,7 @@ public class PutAssignee implements
if (!rsrc.getControl().canEditAssignee()) { if (!rsrc.getControl().canEditAssignee()) {
throw new AuthException("Changing Assignee not permitted"); throw new AuthException("Changing Assignee not permitted");
} }
if (Strings.isNullOrEmpty(input.assignee)) { if (input.assignee == null || input.assignee.trim().isEmpty()) {
throw new BadRequestException("missing assignee field"); throw new BadRequestException("missing assignee field");
} }