-
Notifications
You must be signed in to change notification settings - Fork 0
/
DelegatingNotificationsModule.go
66 lines (52 loc) · 1.75 KB
/
DelegatingNotificationsModule.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"os"
)
type DelegatingNotificationsModule struct {
activationModule *ActivationModule
notificationModules []NotificationModule
notifications []Notification
}
func NewDelegatingNotificationsModule(activationModule *ActivationModule, notificationModules []NotificationModule) *DelegatingNotificationsModule {
module := new(DelegatingNotificationsModule)
module.activationModule = activationModule
module.notificationModules = notificationModules
return module
}
func (t *DelegatingNotificationsModule) Name() string {
return "DelegatingNotificationsModule"
}
func (t *DelegatingNotificationsModule) Description() string {
return "Sends notificationModule about changes in other modules to a ms teams incoming web hook"
}
func (t *DelegatingNotificationsModule) CanBeDisabled() bool {
return false
}
func (t *DelegatingNotificationsModule) UpdateSettings() {
// this intentionally empty
}
func (t *DelegatingNotificationsModule) NeedsExternalData() bool {
return false
}
func (t *DelegatingNotificationsModule) UpdateExternalData() {
// this intentionally empty
}
func (t *DelegatingNotificationsModule) WriteExternalData(_ *os.File) {
// this intentionally empty
}
func (t *DelegatingNotificationsModule) CreateActions(_ []Tag) []action {
return []action{}
}
func (t *DelegatingNotificationsModule) ReadExternalData(_ []byte) error {
return nil
}
func (t *DelegatingNotificationsModule) AddNotification(notification Notification) {
t.notifications = append(t.notifications, notification)
}
func (t *DelegatingNotificationsModule) notify() {
for _, notificationModule := range t.notificationModules {
if t.activationModule.IsNotificationModuleActive(notificationModule) {
notificationModule.notify(t.notifications)
}
}
}