src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt

changeset 186
05eec764facd
parent 185
5ec9fcfbdf9c
child 191
193ee4828767
     1.1 --- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Sun Apr 04 11:52:30 2021 +0200
     1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Sun Apr 04 13:03:41 2021 +0200
     1.3 @@ -63,9 +63,9 @@
     1.4  
     1.5          get("/%project/issues/%version/%component/%issue", this::issue)
     1.6          get("/%project/issues/%version/%component/%issue/edit", this::issueForm)
     1.7 -        get("/%project/issues/%version/%component/%issue/comment", this::issueComment)
     1.8 +        post("/%project/issues/%version/%component/%issue/comment", this::issueComment)
     1.9          get("/%project/issues/%version/%component/-/create", this::issueForm)
    1.10 -        get("/%project/issues/%version/%component/-/commit", this::issueCommit)
    1.11 +        post("/%project/issues/%version/%component/-/commit", this::issueCommit)
    1.12      }
    1.13  
    1.14      fun projects(http: HttpRequest, dao: DataAccessObject) {
    1.15 @@ -508,7 +508,7 @@
    1.16                          else -> dao.findUser(it)
    1.17                      }
    1.18                  }
    1.19 -                eta = http.param("eta")?.let { Date.valueOf(it) }
    1.20 +                eta = http.param("eta")?.let { if (it.isBlank()) null else Date.valueOf(it) }
    1.21  
    1.22                  affectedVersions = http.paramArray("affected")
    1.23                      .mapNotNull { param -> param.toIntOrNull()?.let { Version(it, projectInfo.project.id) } }
    1.24 @@ -516,10 +516,17 @@
    1.25                      .mapNotNull { param -> param.toIntOrNull()?.let { Version(it, projectInfo.project.id) } }
    1.26              }
    1.27  
    1.28 -            if (http.param("more").toBoolean()) {
    1.29 +            val openId = if (issue.id < 0) {
    1.30 +                dao.insertIssue(issue)
    1.31 +            } else {
    1.32 +                dao.updateIssue(issue)
    1.33 +                issue.id
    1.34 +            }
    1.35 +
    1.36 +            if (http.param("more") != null) {
    1.37                  http.renderCommit("${issuesHref}-/create")
    1.38              } else {
    1.39 -                http.renderCommit("${issuesHref}${issue.id}")
    1.40 +                http.renderCommit("${issuesHref}${openId}")
    1.41              }
    1.42          }
    1.43      }

mercurial