mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 11:16:11 +01:00
Rename to ActorData
This commit is contained in:
parent
09058c13c5
commit
78fc75135f
|
@ -14,7 +14,7 @@ type ActorData struct {
|
||||||
port string // optional
|
port string // optional
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a ActorData) ValidateActor() error {
|
func (a ActorData) ValidateActorData() error {
|
||||||
|
|
||||||
if a.schema == "" || a.host == "" {
|
if a.schema == "" || a.host == "" {
|
||||||
return fmt.Errorf("the actor ID was not valid: Invalid Schema or Host")
|
return fmt.Errorf("the actor ID was not valid: Invalid Schema or Host")
|
||||||
|
@ -28,7 +28,7 @@ func (a ActorData) ValidateActor() error {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseActor(actor string) (ActorData, error) {
|
func ParseActorData(actor string) (ActorData, error) {
|
||||||
u, err := url.Parse(actor)
|
u, err := url.Parse(actor)
|
||||||
|
|
||||||
// check if userID IRI is well formed url
|
// check if userID IRI is well formed url
|
||||||
|
|
|
@ -78,7 +78,7 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
|
|
||||||
// assume actor is: "actor": "https://codeberg.org/api/v1/activitypub/user-id/12345" - NB: This might be actually the ID? Maybe check vocabulary.
|
// assume actor is: "actor": "https://codeberg.org/api/v1/activitypub/user-id/12345" - NB: This might be actually the ID? Maybe check vocabulary.
|
||||||
// parse actor
|
// parse actor
|
||||||
actor, err := activitypub.ParseActor(opt.Actor.GetID().String())
|
actor, err := activitypub.ParseActorData(opt.Actor.GetID().String())
|
||||||
|
|
||||||
// Is the actor IRI well formed?
|
// Is the actor IRI well formed?
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -86,7 +86,7 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the ActorData Struct valid?
|
// Is the ActorData Struct valid?
|
||||||
err = actor.ValidateActor()
|
err = actor.ValidateActorData()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in a new issue