fixes some minor migration regressions

Sun, 04 Apr 2021 13:03:41 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 04 Apr 2021 13:03:41 +0200
changeset 186
05eec764facd
parent 185
5ec9fcfbdf9c
child 187
0bf35031a918

fixes some minor migration regressions

src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/issue-form.jsp file | annotate | diff | comparison | revisions
     1.1 --- a/src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt	Sun Apr 04 11:52:30 2021 +0200
     1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt	Sun Apr 04 13:03:41 2021 +0200
     1.3 @@ -38,7 +38,7 @@
     1.4      var category = IssueCategory.Feature
     1.5  
     1.6      var subject: String = ""
     1.7 -    var description: String = ""
     1.8 +    var description: String? = null
     1.9      var assignee: User? = null
    1.10  
    1.11      var created: Timestamp = Timestamp.from(Instant.now())
     2.1 --- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Sun Apr 04 11:52:30 2021 +0200
     2.2 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Sun Apr 04 13:03:41 2021 +0200
     2.3 @@ -63,9 +63,9 @@
     2.4  
     2.5          get("/%project/issues/%version/%component/%issue", this::issue)
     2.6          get("/%project/issues/%version/%component/%issue/edit", this::issueForm)
     2.7 -        get("/%project/issues/%version/%component/%issue/comment", this::issueComment)
     2.8 +        post("/%project/issues/%version/%component/%issue/comment", this::issueComment)
     2.9          get("/%project/issues/%version/%component/-/create", this::issueForm)
    2.10 -        get("/%project/issues/%version/%component/-/commit", this::issueCommit)
    2.11 +        post("/%project/issues/%version/%component/-/commit", this::issueCommit)
    2.12      }
    2.13  
    2.14      fun projects(http: HttpRequest, dao: DataAccessObject) {
    2.15 @@ -508,7 +508,7 @@
    2.16                          else -> dao.findUser(it)
    2.17                      }
    2.18                  }
    2.19 -                eta = http.param("eta")?.let { Date.valueOf(it) }
    2.20 +                eta = http.param("eta")?.let { if (it.isBlank()) null else Date.valueOf(it) }
    2.21  
    2.22                  affectedVersions = http.paramArray("affected")
    2.23                      .mapNotNull { param -> param.toIntOrNull()?.let { Version(it, projectInfo.project.id) } }
    2.24 @@ -516,10 +516,17 @@
    2.25                      .mapNotNull { param -> param.toIntOrNull()?.let { Version(it, projectInfo.project.id) } }
    2.26              }
    2.27  
    2.28 -            if (http.param("more").toBoolean()) {
    2.29 +            val openId = if (issue.id < 0) {
    2.30 +                dao.insertIssue(issue)
    2.31 +            } else {
    2.32 +                dao.updateIssue(issue)
    2.33 +                issue.id
    2.34 +            }
    2.35 +
    2.36 +            if (http.param("more") != null) {
    2.37                  http.renderCommit("${issuesHref}-/create")
    2.38              } else {
    2.39 -                http.renderCommit("${issuesHref}${issue.id}")
    2.40 +                http.renderCommit("${issuesHref}${openId}")
    2.41              }
    2.42          }
    2.43      }
     3.1 --- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt	Sun Apr 04 11:52:30 2021 +0200
     3.2 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt	Sun Apr 04 13:03:41 2021 +0200
     3.3 @@ -76,7 +76,7 @@
     3.4          val renderer = HtmlRenderer.builder(options).build()
     3.5          val process = fun(it: String) = renderer.render(parser.parse(it))
     3.6  
     3.7 -        issue.description = process(issue.description)
     3.8 +        issue.description = process(issue.description?:"")
     3.9          for (comment in comments) {
    3.10              comment.comment = process(comment.comment)
    3.11          }
    3.12 @@ -111,8 +111,8 @@
    3.13                  upcoming.add(v)
    3.14              }
    3.15          }
    3.16 -        versionsRecent = recent
    3.17 -        versionsUpcoming = upcoming
    3.18 +        versionsRecent = recent.distinct()
    3.19 +        versionsUpcoming = upcoming.distinct()
    3.20      }
    3.21  }
    3.22  
     4.1 --- a/src/main/webapp/WEB-INF/jsp/issue-form.jsp	Sun Apr 04 11:52:30 2021 +0200
     4.2 +++ b/src/main/webapp/WEB-INF/jsp/issue-form.jsp	Sun Apr 04 13:03:41 2021 +0200
     4.3 @@ -37,7 +37,7 @@
     4.4  
     4.5  <c:set var="issuesHref" value="./projects/${project.node}/issues/${empty version ? '-' : version.node }/${empty component ? '-' : component.node}/"/>
     4.6  
     4.7 -<form action="${issuesHref}-/commit-issue" method="post">
     4.8 +<form action="${issuesHref}-/commit" method="post">
     4.9      <table class="formtable fullwidth">
    4.10          <colgroup>
    4.11              <col>
    4.12 @@ -89,11 +89,11 @@
    4.13              <td>
    4.14                  <select name="component">
    4.15                      <option value="-1"><fmt:message key="placeholder.null-component"/></option>
    4.16 -                    <c:forEach var="component" items="${viewmodel.components}">
    4.17 +                    <c:forEach var="comp" items="${viewmodel.components}">
    4.18                          <option
    4.19 -                                <c:if test="${not empty issue.component and component eq issue.component}">selected</c:if>
    4.20 -                                <c:if test="${empty issue.component and component.id eq cid}">selected</c:if>
    4.21 -                                value="${component.id}"><c:out value="${component.name}"/></option>
    4.22 +                                <c:if test="${not empty issue.component and comp eq issue.component}">selected</c:if>
    4.23 +                                <c:if test="${empty issue.component and comp eq comp}">selected</c:if>
    4.24 +                                value="${comp.id}"><c:out value="${comp.name}"/></option>
    4.25                      </c:forEach>
    4.26                  </select>
    4.27              </td>

mercurial