Skip to content

Commit

Permalink
Merge pull request #692 from IDgis/690-unique-name-validation
Browse files Browse the repository at this point in the history
only perform unique name check for new items
  • Loading branch information
copierrj committed Jun 9, 2015
2 parents f50f033 + 7d32c35 commit 6de8d42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions publisher-web/app/controllers/Groups.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ public static Promise<Result> submitCreateUpdate () {
final Form<GroupForm> form = Form.form (GroupForm.class).bindFromRequest ();
final String name = form.field ("name").valueOr (null);

if (name == null) {
return performCreateUpdate(database, form);
} else {
if (form.field("id").value().equals(ID) && name != null) {
return from (database)
.query (new ValidateUniqueName (name))
.executeFlat (validationResult -> {
Expand All @@ -166,6 +164,8 @@ public static Promise<Result> submitCreateUpdate () {

return performCreateUpdate (database, form);
});
} else {
return performCreateUpdate (database, form);
}
}

Expand Down
6 changes: 3 additions & 3 deletions publisher-web/app/controllers/Layers.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ public static Promise<Result> submitCreateUpdate () {

Logger.debug ("performing unique check for name: " + name);

if (name == null) {
return performCreateUpdate (database, form);
} else {
if (form.field("id").value().equals(ID) && name != null) {
return from (database)
.query (new ValidateUniqueName (name))
.executeFlat (validationResult -> {
Expand All @@ -169,6 +167,8 @@ public static Promise<Result> submitCreateUpdate () {

return performCreateUpdate (database, form);
});
} else {
return performCreateUpdate (database, form);
}
}

Expand Down

0 comments on commit 6de8d42

Please sign in to comment.