Fix linting errors (errcheck)
parent
819e495dc0
commit
1bc8e67e9c
|
@ -44,9 +44,12 @@ func (b Branch) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
func JSONLoadBranch(val *fastjson.Value, b *Branch) error {
|
||||
ap.OnObject(&b.Object, func(o *ap.Object) error {
|
||||
if err := ap.OnObject(&b.Object, func(o *ap.Object) error {
|
||||
return ap.JSONLoadObject(val, o)
|
||||
})
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
b.Ref = ap.JSONGetItem(val, "ref")
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -50,9 +50,12 @@ func (c Commit) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
func JSONLoadCommit(val *fastjson.Value, c *Commit) error {
|
||||
ap.OnObject(&c.Object, func(o *ap.Object) error {
|
||||
if err := ap.OnObject(&c.Object, func(o *ap.Object) error {
|
||||
return ap.JSONLoadObject(val, o)
|
||||
})
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.Created = ap.JSONGetTime(val, "created")
|
||||
c.Committed = ap.JSONGetTime(val, "committed")
|
||||
return nil
|
||||
|
|
|
@ -54,9 +54,12 @@ func (p Push) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
func JSONLoadPush(val *fastjson.Value, p *Push) error {
|
||||
ap.OnObject(&p.Object, func(o *ap.Object) error {
|
||||
if err := ap.OnObject(&p.Object, func(o *ap.Object) error {
|
||||
return ap.JSONLoadObject(val, o)
|
||||
})
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
p.Target = ap.JSONGetItem(val, "target")
|
||||
p.HashBefore = ap.JSONGetItem(val, "hashBefore")
|
||||
p.HashAfter = ap.JSONGetItem(val, "hashAfter")
|
||||
|
|
|
@ -55,9 +55,12 @@ func (r Repository) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
func JSONLoadRepository(val *fastjson.Value, r *Repository) error {
|
||||
ap.OnActor(&r.Actor, func(a *ap.Actor) error {
|
||||
if err := ap.OnActor(&r.Actor, func(a *ap.Actor) error {
|
||||
return ap.JSONLoadActor(val, a)
|
||||
})
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
r.Team = ap.JSONGetItem(val, "team")
|
||||
r.Forks = ap.JSONGetItem(val, "forks")
|
||||
r.ForkedFrom = ap.JSONGetItem(val, "forkedFrom")
|
||||
|
|
|
@ -182,7 +182,7 @@ func PersonOutbox(ctx *context.APIContext) {
|
|||
if action.OpType == models.ActionCreateRepo {
|
||||
// Created a repo
|
||||
object := ap.Note{Type: ap.NoteType, Content: ap.NaturalLanguageValuesNew()}
|
||||
object.Content.Set("en", ap.Content(action.GetRepoName()))
|
||||
_ = object.Content.Set("en", ap.Content(action.GetRepoName()))
|
||||
create := ap.Create{Type: ap.CreateType, Object: object}
|
||||
err := outbox.OrderedItems.Append(create)
|
||||
if err != nil {
|
||||
|
@ -200,7 +200,7 @@ func PersonOutbox(ctx *context.APIContext) {
|
|||
|
||||
for _, star := range stars {
|
||||
object := ap.Note{Type: ap.NoteType, Content: ap.NaturalLanguageValuesNew()}
|
||||
object.Content.Set("en", ap.Content("Starred "+star.Name))
|
||||
_ = object.Content.Set("en", ap.Content("Starred "+star.Name))
|
||||
create := ap.Create{Type: ap.CreateType, Object: object}
|
||||
err := outbox.OrderedItems.Append(create)
|
||||
if err != nil {
|
||||
|
|
|
@ -79,7 +79,11 @@ func verifyHTTPSignatures(ctx *gitea_context.APIContext) (authenticated bool, er
|
|||
}
|
||||
// 4. Create a federated user for the actor
|
||||
var person ap.Person
|
||||
person.UnmarshalJSON(b)
|
||||
err = person.UnmarshalJSON(b)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = activitypub.FederatedUserNew(ctx, &person)
|
||||
return authenticated, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue