File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,11 @@ import (
16
16
"time"
17
17
)
18
18
19
- // LooseCategory is the category used to indicate that the event is without a fixed date or deadline
19
+ // LooseCategory is the category used to indicate that the event is without a
20
+ // fixed date or deadline
20
21
const LooseCategory = "loose"
21
- // ShowAlarmCategory is the category used to indicate that the alarm details should be displayed in the notification
22
+ // ShowAlarmCategory is the category used to indicate that the alarm details
23
+ // should be displayed in the notification
22
24
const ShowAlarmCategory = "show-alarm"
23
25
24
26
type Parser struct {
Original file line number Diff line number Diff line change 5
5
)
6
6
7
7
const Tpl = `
8
+ {{- if and (not .Loose) .IsImminent}}
9
+ 📢🔥🚨 IN {{.TimeDifference}} 🚨🔥📢
10
+ {{- end}}
8
11
{{- if .Summary}}
9
12
<b>{{.Summary}}</b>
10
13
<b> </b>
@@ -45,16 +48,10 @@ Attendees:
45
48
{{- end}}
46
49
{{- if .ShowAlarm}}
47
50
{{.Source}} 🔔 {{.DurIso8601}}
48
- {{- end}}
49
-
50
- {{- if and (not .Loose) .IsImminent}}
51
-
52
- 📢🔥🚨 IN {{.TimeDifference}} 🚨🔥📢
53
-
54
51
{{- end}}
55
52
`
56
53
57
- const ImminenceThreshold = 1 * time .Hour
54
+ const ImminenceThreshold = 2 * time .Hour
58
55
59
56
type Notifier interface {
60
57
Notify (n Notification ) error
@@ -122,9 +119,9 @@ func (n Notification) EventTimeTz() string {
122
119
return n .EventTime .Location ().String ()
123
120
}
124
121
125
- // IsUrgent checks if the notification is urgent based on the difference between EventTime and Time
122
+ // IsImminent checks if the notification is urgent based on the difference between EventTime and Time
126
123
func (n Notification ) IsImminent () bool {
127
- return n .EventTime .Sub (n .Time ) > ImminenceThreshold
124
+ return n .EventTime .Sub (n .Time ) < ImminenceThreshold
128
125
}
129
126
130
127
// TimeDifference returns the difference between EventTime and Time
You can’t perform that action at this time.
0 commit comments