Skip to content

Commit dc2b127

Browse files
committed
Update to new jcal parsing version to support all day events
1 parent 3eb910a commit dc2b127

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.22.0
44

55
require (
66
github.com/go-co-op/gocron v1.37.0
7-
github.com/xHain-hackspace/go-jcal v0.0.3
7+
github.com/xHain-hackspace/go-jcal v0.0.5
88
gopkg.in/yaml.v3 v3.0.1
99
maunium.net/go/mautrix v0.11.0
1010
)

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
3030
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
3131
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
3232
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
33-
github.com/xHain-hackspace/go-jcal v0.0.3 h1:2FcfP0FimmhMOUCHQ6uXCWgNJnk3OQImbZSFKt8zBbI=
34-
github.com/xHain-hackspace/go-jcal v0.0.3/go.mod h1:TtrDntq5LuHqIYYnPTBmM5fAD0EMWRf+ZS7H+3XpwHM=
33+
github.com/xHain-hackspace/go-jcal v0.0.5 h1:fvAgMaSMuVbYtWdqOG18OpG8XShgOEhq5PKINbT+ToU=
34+
github.com/xHain-hackspace/go-jcal v0.0.5/go.mod h1:TtrDntq5LuHqIYYnPTBmM5fAD0EMWRf+ZS7H+3XpwHM=
3535
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
3636
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
3737
golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 h1:NUzdAbFtCJSXU20AOXgeqaUwg8Ypg4MPYmL+d+rsB5c=

internal/message/message.go

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type Event struct {
2020
EndTime string
2121
HtmlDescription string
2222
TxtDescription string
23+
IsAllDay bool
2324
}
2425

2526
type TemplatedMessage struct {
@@ -37,6 +38,7 @@ func NewTemplatedMessage(htmlTemplate, txtTemplate string, events []calendar.Eve
3738
EndTime: evt.End.In(tz).Format(timeLayout),
3839
HtmlDescription: strings.ReplaceAll(strings.ReplaceAll(evt.Description, "\n", "<br>"), "\\", ""),
3940
TxtDescription: evt.Description,
41+
IsAllDay: evt.IsAllDay,
4042
}
4143

4244
msg.Events = append(msg.Events, event)

pkg/calendar/calendar.go

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Event struct {
1919
End time.Time
2020
Summary string
2121
Description string
22+
IsAllDay bool
2223
}
2324

2425
type NextcloudCalendar struct {
@@ -101,5 +102,6 @@ func fromJcal(jEvent jcal.Event) Event {
101102
Description: jEvent.Description,
102103
Start: jEvent.DtStart,
103104
End: jEvent.DtEnd,
105+
IsAllDay: jEvent.IsAllDay,
104106
}
105107
}

templates/event.html

+2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ <h3>Events on {{ today }}</h3>
22
<ul>
33
{{range .Events}}
44
<li>
5+
{{ if not .IsAllDay }}
56
{{.StartTime}} - {{.EndTime}}<br>
7+
{{ end }}
68
{{.Summary}} <br>
79
{{ if ne .HtmlDescription `` }}
810
({{.HtmlDescription}})

0 commit comments

Comments
 (0)