Set Actor on Create activities
This commit is contained in:
parent
adb161c6ee
commit
be2a3375f3
|
@ -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))},
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue