Fix trails being unavailable when profile is private (#986)
This commit is contained in:
@@ -198,7 +198,8 @@ func assembleActor(app core.App, ctx context.Context, dbActor *core.Record, incl
|
|||||||
result := make(map[string]interface{})
|
result := make(map[string]interface{})
|
||||||
json.Unmarshal([]byte(privacy), &result)
|
json.Unmarshal([]byte(privacy), &result)
|
||||||
|
|
||||||
private = result["account"] == "private"
|
// check that it's not our own profile
|
||||||
|
private = result["account"] == "private" && dbActor.Id != strings.TrimPrefix(ctx.Value("actor").(string), "actor:")
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ func RemoteTrailGet(e *core.RequestEvent) error {
|
|||||||
// Construct the IRI first to see if we already know this trail.
|
// Construct the IRI first to see if we already know this trail.
|
||||||
record, err = findLocalTrailByRemoteInfo(e, ctx, handle, trailID)
|
record, err = findLocalTrailByRemoteInfo(e, ctx, handle, trailID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Is(err, federation.ErrProfilePrivate) {
|
||||||
|
return e.NotFoundError("profile is private", err)
|
||||||
|
}
|
||||||
return e.InternalServerError("Failed to resolve trail", err)
|
return e.InternalServerError("Failed to resolve trail", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user