commit - 00a66b61a581bd514c70d7170958032fb0129bf7
commit + 1738cb32b92b94d71cf623fa3e84afaef401a211
blob - 0ba7ff4eb378b0ba7e6afead99b05991a4dd552b
blob + b51d6126a1a803d43253f2f12cb04b127470f2f9
--- apub.go
+++ apub.go
} `json:"source,omitempty"`
PublicKey *PublicKey `json:"publicKey,omitempty"`
Audience string `json:"audience,omitempty"`
+ Tag []Activity `json:"tag,omitempty"`
Object json.RawMessage `json:"object,omitempty"`
}
blob - c262154f5b118c860be68a4b293b7685d9d63e73
blob + 4117b5de1e745b4944071681904bb67c6bdb4738
--- apub_test.go
+++ apub_test.go
t.Errorf("wanted wrapped activity id %s, got %s", want, inner.ID)
}
}
+
+func TestTag(t *testing.T) {
+ tests := []struct {
+ Name string
+ Mention string
+ }{
+ {"testdata/note/akkoma.json", "@otl@apubtest2.srcbeat.com"},
+ {"testdata/note/lemmy.json", "@Feathercrown@lemmy.world"},
+ {"testdata/note/mastodon.json", "@selfhosted@lemmy.world"},
+ }
+ for _, tt := range tests {
+ f, err := os.Open(tt.Name)
+ if err != nil {
+ t.Error(err)
+ continue
+ }
+ defer f.Close()
+ a, err := Decode(f)
+ if err != nil {
+ t.Errorf("%s: decode: %v", tt.Name, err)
+ continue
+ }
+ if len(a.Tag) == 0 {
+ t.Errorf("%s: no tags", tt.Name)
+ continue
+ }
+ var found bool
+ for _, tag := range a.Tag {
+ if tag.Name == tt.Mention {
+ found = true
+ }
+ }
+ if !found {
+ t.Errorf("%s: did not find mention %s", tt.Name, tt.Mention)
+ }
+ }
+}