Lint
This commit is contained in:
@@ -29,16 +29,19 @@ class NoteController(
|
||||
|
||||
val markdownForm = request.form("markdown") ?: ""
|
||||
|
||||
return noteService.create(jwtPayload.userId, markdownForm).fold({
|
||||
val html = when (it) {
|
||||
MissingMeta -> view.noteEditor(jwtPayload, error = "Missing note metadata", textarea = markdownForm)
|
||||
InvalidMeta -> view.noteEditor(jwtPayload, error = "Invalid note metadata", textarea = markdownForm)
|
||||
is ValidationError -> view.noteEditor(jwtPayload, validationErrors = it.validationErrors, textarea = markdownForm)
|
||||
return noteService.create(jwtPayload.userId, markdownForm).fold(
|
||||
{
|
||||
val html = when (it) {
|
||||
MissingMeta -> view.noteEditor(jwtPayload, error = "Missing note metadata", textarea = markdownForm)
|
||||
InvalidMeta -> view.noteEditor(jwtPayload, error = "Invalid note metadata", textarea = markdownForm)
|
||||
is ValidationError -> view.noteEditor(jwtPayload, validationErrors = it.validationErrors, textarea = markdownForm)
|
||||
}
|
||||
Response(BAD_REQUEST).html(html)
|
||||
},
|
||||
{
|
||||
Response.redirect("/notes/${it.uuid}")
|
||||
}
|
||||
Response(BAD_REQUEST).html(html)
|
||||
}, {
|
||||
Response.redirect("/notes/${it.uuid}")
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
fun list(request: Request, jwtPayload: JwtPayload): Response {
|
||||
@@ -71,17 +74,19 @@ class NoteController(
|
||||
|
||||
val markdownForm = request.form("markdown") ?: ""
|
||||
|
||||
return noteService.update(jwtPayload.userId, note.uuid, markdownForm).fold({
|
||||
val html = when (it) {
|
||||
MissingMeta -> view.noteEditor(jwtPayload, error = "Missing note metadata", textarea = markdownForm)
|
||||
InvalidMeta -> view.noteEditor(jwtPayload, error = "Invalid note metadata", textarea = markdownForm)
|
||||
is ValidationError -> view.noteEditor(jwtPayload, validationErrors = it.validationErrors, textarea = markdownForm)
|
||||
return noteService.update(jwtPayload.userId, note.uuid, markdownForm).fold(
|
||||
{
|
||||
val html = when (it) {
|
||||
MissingMeta -> view.noteEditor(jwtPayload, error = "Missing note metadata", textarea = markdownForm)
|
||||
InvalidMeta -> view.noteEditor(jwtPayload, error = "Invalid note metadata", textarea = markdownForm)
|
||||
is ValidationError -> view.noteEditor(jwtPayload, validationErrors = it.validationErrors, textarea = markdownForm)
|
||||
}
|
||||
Response(BAD_REQUEST).html(html)
|
||||
},
|
||||
{
|
||||
Response.redirect("/notes/${note.uuid}")
|
||||
}
|
||||
Response(BAD_REQUEST).html(html)
|
||||
}, {
|
||||
Response.redirect("/notes/${note.uuid}")
|
||||
})
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
private fun Request.uuidPath(): UUID? {
|
||||
@@ -92,5 +97,4 @@ class NoteController(
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user