fix(ap): resolve issue where follows would not work if private mode was enabled. Fixes #4142 (#4202)
This commit is contained in:
@@ -47,7 +47,7 @@ func handleFollowInboxRequest(c context.Context, activity vocab.ActivityStreamsF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save as an accepted activity
|
// Save as an activity
|
||||||
actorReference := activity.GetActivityStreamsActor()
|
actorReference := activity.GetActivityStreamsActor()
|
||||||
object := activity.GetActivityStreamsObject()
|
object := activity.GetActivityStreamsObject()
|
||||||
objectIRI := object.At(0).GetIRI().String()
|
objectIRI := object.At(0).GetIRI().String()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package persistence
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
@@ -74,6 +75,27 @@ func GetFollower(iri string) (*apmodels.ActivityPubActor, error) {
|
|||||||
return nil, errors.Wrap(err, "error parsing acting inbox")
|
return nil, errors.Wrap(err, "error parsing acting inbox")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requestObjectBytes := result.RequestObject
|
||||||
|
var followRequestObject vocab.ActivityStreamsFollow
|
||||||
|
|
||||||
|
resolver, err := streams.NewJSONResolver(func(c context.Context, followObject vocab.ActivityStreamsFollow) error {
|
||||||
|
followRequestObject = followObject
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "error creating JSON resolver")
|
||||||
|
}
|
||||||
|
jsonMap := make(map[string]interface{})
|
||||||
|
err = json.Unmarshal(requestObjectBytes, &jsonMap)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "error unmarshaling follow request object")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = resolver.Resolve(context.Background(), jsonMap)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "error resolving follow request object")
|
||||||
|
}
|
||||||
|
|
||||||
image, _ := url.Parse(result.Image.String)
|
image, _ := url.Parse(result.Image.String)
|
||||||
|
|
||||||
var disabledAt *time.Time
|
var disabledAt *time.Time
|
||||||
@@ -89,6 +111,7 @@ func GetFollower(iri string) (*apmodels.ActivityPubActor, error) {
|
|||||||
Image: image,
|
Image: image,
|
||||||
FollowRequestIri: followIRI,
|
FollowRequestIri: followIRI,
|
||||||
DisabledAt: disabledAt,
|
DisabledAt: disabledAt,
|
||||||
|
RequestObject: followRequestObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &follower, nil
|
return &follower, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user