Skip to content

Commit 73284db

Browse files
author
Anthony Wang
committed
Add authorize_interaction case for Tickets
1 parent c0efded commit 73284db

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

modules/activitypub/authorize_interaction.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ func AuthorizeInteraction(ctx *context.Context) {
6565
return
6666
}
6767
ctx.Redirect(username + "/" + reponame)
68+
case forgefed.TicketType:
69+
err = forgefed.OnTicket(object, func(t *forgefed.Ticket) error {
70+
return ReceiveIssue(ctx, t)
71+
})
72+
if err != nil {
73+
ctx.ServerError("ReceiveIssue", err)
74+
return
75+
}
76+
// TODO: Implement ticketIRIToName and redirect to ticket
6877
}
6978

7079
ctx.Status(http.StatusOK)

modules/activitypub/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
// Create an issue
14-
func Issue(ctx context.Context, ticket *forgefed.Ticket) error {
14+
func ReceiveIssue(ctx context.Context, ticket *forgefed.Ticket) error {
1515
// TODO
1616
return nil
1717
}

routers/api/v1/activitypub/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func RepoInbox(ctx *context.APIContext) {
136136
return activitypub.PullRequest(ctx, t)
137137
}
138138
// New issue
139-
return activitypub.Issue(ctx, t)
139+
return activitypub.ReceiveIssue(ctx, t)
140140
})
141141
case ap.NoteType:
142142
// New comment

0 commit comments

Comments
 (0)