Set Actor on Create activities
This commit is contained in:
parent
adb161c6ee
commit
be2a3375f3
|
@ -4,12 +4,15 @@
|
||||||
package activitypub
|
package activitypub
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
|
|
||||||
ap "github.com/go-ap/activitypub"
|
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{
|
return &ap.Create{
|
||||||
Type: ap.CreateType,
|
Type: ap.CreateType,
|
||||||
|
Actor: ap.IRI(user.GetIRI()),
|
||||||
Object: object,
|
Object: object,
|
||||||
To: ap.ItemCollection{ap.Item(ap.IRI(to))},
|
To: ap.ItemCollection{ap.Item(ap.IRI(to))},
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ func CreateIssueComment(ctx context.Context, doer *user_model.User, repo *repo_m
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
create := activitypub.Create(repo.OriginalURL+"/inbox", note)
|
create := activitypub.Create(doer, note, repo.OriginalURL+"/inbox")
|
||||||
err = activitypub.Send(doer, create)
|
err = activitypub.Send(doer, create)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -33,7 +33,8 @@ func NewIssue(repo *repo_model.Repository, issue *issues_model.Issue, labelIDs [
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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)
|
err = activitypub.Send(issue.Poster, create)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Reference in New Issue