forked from tangled.org/core
Monorepo for Tangled — https://tangled.org
1package notify 2 3import ( 4 "context" 5 6 "tangled.org/core/appview/db" 7 "tangled.org/core/appview/models" 8) 9 10type mergedNotifier struct { 11 notifiers []Notifier 12} 13 14func NewMergedNotifier(notifiers ...Notifier) Notifier { 15 return &mergedNotifier{notifiers} 16} 17 18var _ Notifier = &mergedNotifier{} 19 20func (m *mergedNotifier) NewRepo(ctx context.Context, repo *models.Repo) { 21 for _, notifier := range m.notifiers { 22 notifier.NewRepo(ctx, repo) 23 } 24} 25 26func (m *mergedNotifier) NewStar(ctx context.Context, star *db.Star) { 27 for _, notifier := range m.notifiers { 28 notifier.NewStar(ctx, star) 29 } 30} 31func (m *mergedNotifier) DeleteStar(ctx context.Context, star *db.Star) { 32 for _, notifier := range m.notifiers { 33 notifier.DeleteStar(ctx, star) 34 } 35} 36 37func (m *mergedNotifier) NewIssue(ctx context.Context, issue *models.Issue) { 38 for _, notifier := range m.notifiers { 39 notifier.NewIssue(ctx, issue) 40 } 41} 42 43func (m *mergedNotifier) NewFollow(ctx context.Context, follow *models.Follow) { 44 for _, notifier := range m.notifiers { 45 notifier.NewFollow(ctx, follow) 46 } 47} 48func (m *mergedNotifier) DeleteFollow(ctx context.Context, follow *models.Follow) { 49 for _, notifier := range m.notifiers { 50 notifier.DeleteFollow(ctx, follow) 51 } 52} 53 54func (m *mergedNotifier) NewPull(ctx context.Context, pull *models.Pull) { 55 for _, notifier := range m.notifiers { 56 notifier.NewPull(ctx, pull) 57 } 58} 59func (m *mergedNotifier) NewPullComment(ctx context.Context, comment *models.PullComment) { 60 for _, notifier := range m.notifiers { 61 notifier.NewPullComment(ctx, comment) 62 } 63} 64 65func (m *mergedNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) { 66 for _, notifier := range m.notifiers { 67 notifier.UpdateProfile(ctx, profile) 68 } 69} 70 71func (m *mergedNotifier) NewString(ctx context.Context, string *db.String) { 72 for _, notifier := range m.notifiers { 73 notifier.NewString(ctx, string) 74 } 75} 76 77func (m *mergedNotifier) EditString(ctx context.Context, string *db.String) { 78 for _, notifier := range m.notifiers { 79 notifier.EditString(ctx, string) 80 } 81} 82 83func (m *mergedNotifier) DeleteString(ctx context.Context, did, rkey string) { 84 for _, notifier := range m.notifiers { 85 notifier.DeleteString(ctx, did, rkey) 86 } 87}