PostInbox auto Follow/Reject uses IRI only
Part of normalization of IRIs.
このコミットが含まれているのは:
コミット
3d310d5e81
17
pub/fed.go
17
pub/fed.go
@ -929,7 +929,6 @@ func (f *federator) handleDelete(c context.Context) func(s *streams.Delete) erro
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Only Set IRIs
|
||||
func (f *federator) handleFollow(c context.Context, inboxURL *url.URL) func(s *streams.Follow) error {
|
||||
return func(s *streams.Follow) error {
|
||||
// Permit either human-triggered or automatically triggering
|
||||
@ -948,13 +947,23 @@ func (f *federator) handleFollow(c context.Context, inboxURL *url.URL) func(s *s
|
||||
raw := s.Raw()
|
||||
activity.AppendObject(raw)
|
||||
for i := 0; i < raw.ActorLen(); i++ {
|
||||
var to *url.URL
|
||||
if raw.IsActorObject(i) {
|
||||
activity.AppendToObject(raw.GetActorObject(i))
|
||||
obj := raw.GetActorObject(i)
|
||||
if !obj.HasId() {
|
||||
return fmt.Errorf("to object missing id")
|
||||
}
|
||||
to = obj.GetId()
|
||||
} else if raw.IsActorLink(i) {
|
||||
activity.AppendToLink(raw.GetActorLink(i))
|
||||
href := raw.GetActorLink(i)
|
||||
if !href.HasHref() {
|
||||
return fmt.Errorf("to link missing href")
|
||||
}
|
||||
to = href.GetHref()
|
||||
} else if raw.IsActorIRI(i) {
|
||||
activity.AppendToIRI(raw.GetActorIRI(i))
|
||||
to = raw.GetActorIRI(i)
|
||||
}
|
||||
activity.AppendToIRI(to)
|
||||
}
|
||||
ownsAny := false
|
||||
if todo == AutomaticAccept {
|
||||
|
@ -2556,7 +2556,7 @@ func TestPostInbox_Follow_AutoReject(t *testing.T) {
|
||||
}
|
||||
expected := &vocab.Reject{}
|
||||
expected.AppendObject(testFollow)
|
||||
expected.AppendToObject(sallyActor)
|
||||
expected.AppendToIRI(sallyIRI)
|
||||
handled, err := p.PostInbox(context.Background(), resp, req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@ -2683,7 +2683,7 @@ func TestPostInbox_Follow_AutoAccept(t *testing.T) {
|
||||
}
|
||||
expected := &vocab.Accept{}
|
||||
expected.AppendObject(testFollow)
|
||||
expected.AppendToObject(sallyActor)
|
||||
expected.AppendToIRI(sallyIRI)
|
||||
expectedFollowers := &vocab.Collection{}
|
||||
expectedFollowers.AppendItemsIRI(sallyIRI)
|
||||
expectedActor := &vocab.Person{}
|
||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする