1package notify
2
3import (
4 "context"
5
6 "tangled.sh/tangled.sh/core/appview/db"
7)
8
9type mergedNotifier struct {
10 notifiers []Notifier
11}
12
13func NewMergedNotifier(notifiers ...Notifier) Notifier {
14 return &mergedNotifier{notifiers}
15}
16
17var _ Notifier = &mergedNotifier{}
18
19func (m *mergedNotifier) NewRepo(ctx context.Context, repo *db.Repo) {
20 for _, notifier := range m.notifiers {
21 notifier.NewRepo(ctx, repo)
22 }
23}
24
25func (m *mergedNotifier) NewStar(ctx context.Context, star *db.Star) {
26 for _, notifier := range m.notifiers {
27 notifier.NewStar(ctx, star)
28 }
29}
30func (m *mergedNotifier) DeleteStar(ctx context.Context, star *db.Star) {
31 for _, notifier := range m.notifiers {
32 notifier.DeleteStar(ctx, star)
33 }
34}
35
36func (m *mergedNotifier) NewIssue(ctx context.Context, issue *db.Issue) {
37 for _, notifier := range m.notifiers {
38 notifier.NewIssue(ctx, issue)
39 }
40}
41
42func (m *mergedNotifier) NewFollow(ctx context.Context, follow *db.Follow) {
43 for _, notifier := range m.notifiers {
44 notifier.NewFollow(ctx, follow)
45 }
46}
47func (m *mergedNotifier) DeleteFollow(ctx context.Context, follow *db.Follow) {
48 for _, notifier := range m.notifiers {
49 notifier.DeleteFollow(ctx, follow)
50 }
51}
52
53func (m *mergedNotifier) NewPull(ctx context.Context, pull *db.Pull) {
54 for _, notifier := range m.notifiers {
55 notifier.NewPull(ctx, pull)
56 }
57}
58func (m *mergedNotifier) NewPullComment(ctx context.Context, comment *db.PullComment) {
59 for _, notifier := range m.notifiers {
60 notifier.NewPullComment(ctx, comment)
61 }
62}
63
64func (m *mergedNotifier) UpdateProfile(ctx context.Context, profile *db.Profile) {
65 for _, notifier := range m.notifiers {
66 notifier.UpdateProfile(ctx, profile)
67 }
68}