Trim assignees

Be nice to users that overlook whitespace-only input.

Change-Id: I703f6b56f711a90b3ad065c0be16a9ba36ec607c
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-11-30 10:38:39 +01:00
parent 9875c00ed9
commit ff41c0718d
2 changed files with 4 additions and 3 deletions

View File

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

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.server.change;
import com.google.common.base.Strings;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.extensions.api.changes.AddReviewerInput;
import com.google.gerrit.extensions.api.changes.AssigneeInput;
@@ -65,7 +64,7 @@ public class PutAssignee implements
if (!rsrc.getControl().canEditAssignee()) {
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");
}