···
-
func (n *databaseNotifier) NewPullMerged(ctx context.Context, pull *models.Pull) {
repo, err := db.GetRepo(n.db, db.FilterEq("at_uri", string(pull.RepoAt)))
-
log.Printf("NewPullMerged: failed to get repos: %v", err)
···
actorDid := syntax.DID(repo.Did)
-
eventType := models.NotificationTypePullMerged
entityId := pull.PullAt().String()
-
func (n *databaseNotifier) NewPullClosed(ctx context.Context, pull *models.Pull) {
-
repo, err := db.GetRepo(n.db, db.FilterEq("at_uri", string(pull.RepoAt)))
-
log.Printf("NewPullMerged: failed to get repos: %v", err)
-
// build up the recipients list:
-
// - all pull participants
-
var recipients []syntax.DID
-
recipients = append(recipients, syntax.DID(repo.Did))
-
collaborators, err := db.GetCollaborators(n.db, db.FilterEq("repo_at", repo.RepoAt()))
-
log.Printf("failed to fetch collaborators: %v", err)
-
for _, c := range collaborators {
-
recipients = append(recipients, c.SubjectDid)
-
for _, p := range pull.Participants() {
-
recipients = append(recipients, syntax.DID(p))
-
actorDid := syntax.DID(repo.Did)
-
eventType := models.NotificationTypePullClosed
-
entityId := pull.PullAt().String()
-
func (n *databaseNotifier) NewPullReopen(ctx context.Context, pull *models.Pull) {
-
repo, err := db.GetRepo(n.db, db.FilterEq("at_uri", string(pull.RepoAt)))
-
log.Printf("NewPullMerged: failed to get repos: %v", err)
-
// build up the recipients list:
-
// - all pull participants
-
var recipients []syntax.DID
-
recipients = append(recipients, syntax.DID(repo.Did))
-
collaborators, err := db.GetCollaborators(n.db, db.FilterEq("repo_at", repo.RepoAt()))
-
log.Printf("failed to fetch collaborators: %v", err)
-
for _, c := range collaborators {
-
recipients = append(recipients, c.SubjectDid)
-
for _, p := range pull.Participants() {
-
recipients = append(recipients, syntax.DID(p))
-
actorDid := syntax.DID(repo.Did)
-
eventType := models.NotificationTypePullReopen
-
entityId := pull.PullAt().String()
···
+
func (n *databaseNotifier) NewPullState(ctx context.Context, pull *models.Pull) {
repo, err := db.GetRepo(n.db, db.FilterEq("at_uri", string(pull.RepoAt)))
+
log.Printf("NewPullState: failed to get repos: %v", err)
···
actorDid := syntax.DID(repo.Did)
entityId := pull.PullAt().String()
+
var eventType models.NotificationType
+
case models.PullClosed:
+
eventType = models.NotificationTypePullClosed
+
eventType = models.NotificationTypePullReopen
+
case models.PullMerged:
+
eventType = models.NotificationTypePullMerged
+
log.Println("NewPullState: unexpected new PR state:", pull.State)