mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-21 08:31:27 -05:00
Create object manually
This commit is contained in:
parent
b2105de36f
commit
0b8aa3105c
1 changed files with 8 additions and 2 deletions
|
@ -6,6 +6,7 @@ package forgefed
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/validation"
|
"code.gitea.io/gitea/modules/validation"
|
||||||
|
|
||||||
ap "github.com/go-ap/activitypub"
|
ap "github.com/go-ap/activitypub"
|
||||||
|
@ -23,8 +24,13 @@ func NewForgeLike(actorIRI string, objectIRI string) (ForgeLike, error) {
|
||||||
result := ForgeLike{}
|
result := ForgeLike{}
|
||||||
result.Type = ap.LikeType
|
result.Type = ap.LikeType
|
||||||
// ToDo: Would validating the source by Actor.Type field make sense?
|
// ToDo: Would validating the source by Actor.Type field make sense?
|
||||||
result.Actor = ap.ActorNew(ap.IRI(actorIRI), "ForgejoUser") // Thats us, a User
|
object := new(ap.Object)
|
||||||
result.Object = ap.ObjectNew(ap.ActivityVocabularyType(objectIRI)) // Thats them, a Repository
|
object.ID = ap.IRI(objectIRI)
|
||||||
|
object.URL = ap.IRI(objectIRI)
|
||||||
|
|
||||||
|
result.Actor = ap.ActorNew(ap.IRI(actorIRI), "ForgejoUser") // Thats us, a User
|
||||||
|
result.Object = object // Thats them, a Repository
|
||||||
|
log.Info("Object is: %v", object)
|
||||||
result.StartTime = time.Now()
|
result.StartTime = time.Now()
|
||||||
if valid, err := validation.IsValid(result); !valid {
|
if valid, err := validation.IsValid(result); !valid {
|
||||||
return ForgeLike{}, err
|
return ForgeLike{}, err
|
||||||
|
|
Loading…
Reference in a new issue