Check err in Follow() to avoid crash and don't check FederatedUserNew error
parent
6e100301cf
commit
c8a8e1ec91
|
@ -28,7 +28,7 @@ func Follow(ctx context.Context, follow ap.Follow) {
|
||||||
objectIRI := follow.Object.GetID()
|
objectIRI := follow.Object.GetID()
|
||||||
objectUser, err := personIRIToUser(ctx, objectIRI)
|
objectUser, err := personIRIToUser(ctx, objectIRI)
|
||||||
// Must be a local user
|
// Must be a local user
|
||||||
if strings.Contains(objectUser.Name, "@") || err != nil {
|
if err != nil || strings.Contains(objectUser.Name, "@") {
|
||||||
log.Warn("Couldn't find object user for follow", err)
|
log.Warn("Couldn't find object user for follow", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@ func Follow(ctx context.Context, follow ap.Follow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process a Undo follow activity
|
// Process a Undo follow activity
|
||||||
// I haven't tried this yet so hopefully it works
|
|
||||||
func Unfollow(ctx context.Context, unfollow ap.Undo) {
|
func Unfollow(ctx context.Context, unfollow ap.Undo) {
|
||||||
follow := unfollow.Object.(*ap.Follow)
|
follow := unfollow.Object.(*ap.Follow)
|
||||||
// Actor is the user performing the undo follow
|
// Actor is the user performing the undo follow
|
||||||
|
|
|
@ -47,11 +47,7 @@ func personIRIToUser(ctx context.Context, personIRI ap.IRI) (*user_model.User, e
|
||||||
return user, err
|
return user, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = FederatedUserNew(personIRI)
|
FederatedUserNew(personIRI)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return user_model.GetUserByName(ctx, name)
|
return user_model.GetUserByName(ctx, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue