1
0

Fix completion status in DAV for OpenTasks and multiline descriptions (#697)

Add tests for multiline descriptions and completed state

Fix caldav descriptions

Fix caldav task complete status for OpenTasks

Co-authored-by: Martin Giger <martin@humanoids.be>
Reviewed-on: https://kolaente.dev/vikunja/api/pulls/697
Co-Authored-By: freaktechnik <martin@humanoids.be>
Co-Committed-By: freaktechnik <martin@humanoids.be>
This commit is contained in:
freaktechnik
2020-10-21 21:03:19 +00:00
committed by konrad
parent 760278fde6
commit ffce9b51cc
2 changed files with 133 additions and 3 deletions

View File

@ -18,6 +18,7 @@ package caldav
import (
"fmt"
"regexp"
"strconv"
"strings"
"time"
@ -92,11 +93,17 @@ PRODID:-//` + config.ProdID + `//EN`
e.UID = makeCalDavTimeFromTimeStamp(e.Timestamp) + utils.Sha256(e.Summary)
}
formattedDescription := ""
if e.Description != "" {
re := regexp.MustCompile(`\r?\n`)
formattedDescription = re.ReplaceAllString(e.Description, "\\n")
}
caldavevents += `
BEGIN:VEVENT
UID:` + e.UID + `
SUMMARY:` + e.Summary + `
DESCRIPTION:` + e.Description + `
DESCRIPTION:` + formattedDescription + `
DTSTAMP:` + makeCalDavTimeFromTimeStamp(e.Timestamp) + `
DTSTART:` + makeCalDavTimeFromTimeStamp(e.Start) + `
DTEND:` + makeCalDavTimeFromTimeStamp(e.End)
@ -152,12 +159,15 @@ DTSTART: ` + makeCalDavTimeFromTimeStamp(t.Start)
DTEND: ` + makeCalDavTimeFromTimeStamp(t.End)
}
if t.Description != "" {
re := regexp.MustCompile(`\r?\n`)
formattedDescription := re.ReplaceAllString(t.Description, "\\n")
caldavtodos += `
DESCRIPTION:` + t.Description
DESCRIPTION:` + formattedDescription
}
if t.Completed.Unix() > 0 {
caldavtodos += `
COMPLETED: ` + makeCalDavTimeFromTimeStamp(t.Completed)
COMPLETED:` + makeCalDavTimeFromTimeStamp(t.Completed) + `
STATUS:COMPLETED`
}
if t.Organizer != nil {
caldavtodos += `