Set Actor on Create activities

This commit is contained in:
Anthony Wang 2022-12-31 18:26:46 +00:00
parent adb161c6ee
commit be2a3375f3
No known key found for this signature in database
GPG Key ID: 42A5B952E6DD8D38
3 changed files with 7 additions and 3 deletions

View File

@ -4,12 +4,15 @@
package activitypub
import (
user_model "code.gitea.io/gitea/models/user"
ap "github.com/go-ap/activitypub"
)
func Create(to string, object ap.ObjectOrLink) *ap.Create {
func Create(user *user_model.User, object ap.ObjectOrLink, to string) *ap.Create {
return &ap.Create{
Type: ap.CreateType,
Actor: ap.IRI(user.GetIRI()),
Object: object,
To: ap.ItemCollection{ap.Item(ap.IRI(to))},
}

View File

@ -86,7 +86,7 @@ func CreateIssueComment(ctx context.Context, doer *user_model.User, repo *repo_m
if err != nil {
return nil, err
}
create := activitypub.Create(repo.OriginalURL+"/inbox", note)
create := activitypub.Create(doer, note, repo.OriginalURL+"/inbox")
err = activitypub.Send(doer, create)
if err != nil {
return nil, err

View File

@ -33,7 +33,8 @@ func NewIssue(repo *repo_model.Repository, issue *issues_model.Issue, labelIDs [
if err != nil {
return err
}
create := activitypub.Create(repo.OriginalURL+"/inbox", ticket)
issue.LoadPoster(db.DefaultContext)
create := activitypub.Create(issue.Poster, ticket, repo.OriginalURL+"/inbox")
err = activitypub.Send(issue.Poster, create)
if err != nil {
return err