mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Add option to hide declined calendar events
My calendar view looks quite a bit cleaner with meetings I've said "no" to taken out. This change adds a new option `wtf.mods.gcal.showDeclined`, defaulting to `true`, which controls whether or not the gcal module displays events where your status is "declined". I think as a quality of life feature, this is better off defaulting to `false` (i.e. _don't_ show declined events by default), but when it comes to potentially disrupting other users who've gotten used to the existing setup, I'll leave that decision to you.
This commit is contained in:
parent
b6879c1122
commit
f1bbd8564f
@ -44,6 +44,10 @@ func (widget *Widget) contentFrom(calEvents []*CalEvent) string {
|
|||||||
var str string
|
var str string
|
||||||
var prevEvent *CalEvent
|
var prevEvent *CalEvent
|
||||||
|
|
||||||
|
if !wtf.Config.UBool("wtf.mods.gcal.showDeclined", true) {
|
||||||
|
calEvents = removeDeclined(calEvents)
|
||||||
|
}
|
||||||
|
|
||||||
for _, calEvent := range calEvents {
|
for _, calEvent := range calEvents {
|
||||||
timestamp := fmt.Sprintf("[%s]%s", widget.descriptionColor(calEvent), calEvent.Timestamp())
|
timestamp := fmt.Sprintf("[%s]%s", widget.descriptionColor(calEvent), calEvent.Timestamp())
|
||||||
|
|
||||||
@ -223,3 +227,13 @@ func (widget *Widget) responseIcon(calEvent *CalEvent) string {
|
|||||||
|
|
||||||
return " "
|
return " "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func removeDeclined(events []*CalEvent) []*CalEvent {
|
||||||
|
var ret []*CalEvent
|
||||||
|
for _, e := range events {
|
||||||
|
if e.ResponseFor(wtf.Config.UString("wtf.mods.gcal.email")) != "declined" {
|
||||||
|
ret = append(ret, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user