avoid NumberFormatException

This commit is contained in:
xuwei-k
2013-10-14 03:26:47 +09:00
parent 3eab4955b9
commit 5a3207ae42
6 changed files with 55 additions and 32 deletions

View File

@@ -228,13 +228,13 @@ trait IssuesControllerBase extends ControllerBase {
})
post("/:owner/:repository/issues/batchedit/label")(collaboratorsOnly { repository =>
defining(params("value").toInt){ labelId =>
params("value").toIntOpt.map{ labelId =>
executeBatch(repository) { issueId =>
getIssueLabel(repository.owner, repository.name, issueId, labelId) getOrElse {
registerIssueLabel(repository.owner, repository.name, issueId, labelId)
}
}
}
} getOrElse NotFound
})
post("/:owner/:repository/issues/batchedit/assign")(collaboratorsOnly { repository =>
@@ -254,7 +254,7 @@ trait IssuesControllerBase extends ControllerBase {
})
val assignedUserName = (key: String) => params.get(key) filter (_.trim != "")
val milestoneId = (key: String) => params.get(key) collect { case x if x.trim != "" => x.toInt }
val milestoneId: String => Option[Int] = (key: String) => params.get(key).flatMap(_.toIntOpt)
private def isEditable(owner: String, repository: String, author: String)(implicit context: app.Context): Boolean =
hasWritePermission(owner, repository, context.loginAccount) || author == context.loginAccount.get.userName