From 2796a2e82f16ade9872008878cf88299bd66b4e7 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 31 Jul 2023 15:47:35 +0200 Subject: [feature] Hashtag federation (in/out), hashtag client API endpoints (#2032) * update go-fed * do the things * remove unused columns from tags * update to latest lingo from main * further tag shenanigans * serve stub page at tag endpoint * we did it lads * tests, oh tests, ohhh tests, oh tests (doo doo doo doo) * swagger docs * document hashtag usage + federation * instanceGet * don't bother parsing tag href * rename whereStartsWith -> whereStartsLike * remove GetOrCreateTag * dont cache status tag timelineability --- internal/ap/ap_test.go | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) (limited to 'internal/ap/ap_test.go') diff --git a/internal/ap/ap_test.go b/internal/ap/ap_test.go index 105bc1fcf..6a5073c63 100644 --- a/internal/ap/ap_test.go +++ b/internal/ap/ap_test.go @@ -98,6 +98,97 @@ func noteWithMentions1() vocab.ActivityStreamsNote { return note } +func (suite *APTestSuite) noteWithHashtags1() ap.Statusable { + noteJson := []byte(` +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + { + "ostatus": "http://ostatus.org#", + "atomUri": "ostatus:atomUri", + "inReplyToAtomUri": "ostatus:inReplyToAtomUri", + "conversation": "ostatus:conversation", + "sensitive": "as:sensitive", + "toot": "http://joinmastodon.org/ns#", + "votersCount": "toot:votersCount", + "Hashtag": "as:Hashtag" + } + ], + "id": "https://mastodon.social/users/pixelfed/statuses/110609702372389319", + "type": "Note", + "summary": null, + "inReplyTo": null, + "published": "2023-06-26T09:01:56Z", + "url": "https://mastodon.social/@pixelfed/110609702372389319", + "attributedTo": "https://mastodon.social/users/pixelfed", + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "cc": [ + "https://mastodon.social/users/pixelfed/followers", + "https://gts.superseriousbusiness.org/users/gotosocial" + ], + "sensitive": false, + "atomUri": "https://mastodon.social/users/pixelfed/statuses/110609702372389319", + "inReplyToAtomUri": null, + "conversation": "tag:mastodon.social,2023-06-26:objectId=474977189:objectType=Conversation", + "content": "
⚡ Heard of @gotosocial ?
GoToSocial provides a lightweight, customizable, and safety-focused entryway into the #fediverse, you can keep in touch with your friends, post, read, and share images and articles.
Consider #GoToSocial instead of Pixelfed if you'd like a safety-focused alternative with text-only post support that is maintained by a stellar developer community!
We ❤️ GtS, check them out!
🔍 https://fedidb.org/software/gotosocial
", + "contentMap": { + "en": "⚡ Heard of @gotosocial ?
GoToSocial provides a lightweight, customizable, and safety-focused entryway into the #fediverse, you can keep in touch with your friends, post, read, and share images and articles.
Consider #GoToSocial instead of Pixelfed if you'd like a safety-focused alternative with text-only post support that is maintained by a stellar developer community!
We ❤️ GtS, check them out!
" + }, + "attachment": [], + "tag": [ + { + "type": "Mention", + "href": "https://gts.superseriousbusiness.org/users/gotosocial", + "name": "@gotosocial@superseriousbusiness.org" + }, + { + "type": "Hashtag", + "href": "https://mastodon.social/tags/fediverse", + "name": "#fediverse" + }, + { + "type": "Hashtag", + "href": "https://mastodon.social/tags/gotosocial", + "name": "#gotosocial" + }, + { + "type": "Hashtag", + "href": "https://mastodon.social/tags/this_hashtag_will_be_ignored_since_it_cant_be_normalized", + "name": "#b̴̛͇̒̌͑̓̐̑͗̏̐̇͗̎̕͝O̵̧̧͎̟̰̭̊͌͒́̊̑̄̐͐͗Ọ̷̧̡̰̟̪̫̹͖͇̱͕̺̦̲̀̐̽̓̇̚͠b̶̨̖͍͙͈̹͉̯͕̯̯̯̞̼̞̏͊͂̐̔͛s̴̢̞̺͈͇̘͚͉͔̥̔͛͆͑͑̍̄̌̚͜͜ͅ" + }, + { + "type": "Hashtag", + "href": "https://mastodon.social/tags/this_hashtag_will_be_included_correctly", + "name": "#Grüvy" + }, + { + "type": "Hashtag", + "href": "https://mastodon.social/tags/this_hashtag_will_be_squashed_into_a_single_character", + "name": "#` + `ᄀ` + `ᅡ` + `ᆨ` + `" + } + ], + "replies": { + "id": "https://mastodon.social/users/pixelfed/statuses/110609702372389319/replies", + "type": "Collection", + "first": { + "type": "CollectionPage", + "next": "https://mastodon.social/users/pixelfed/statuses/110609702372389319/replies?only_other_accounts=true&page=true", + "partOf": "https://mastodon.social/users/pixelfed/statuses/110609702372389319/replies", + "items": [] + } + } +}`) + + statusable, err := ap.ResolveStatusable(context.Background(), noteJson) + if err != nil { + suite.FailNow(err.Error()) + } + + return statusable +} + func addressable1() ap.Addressable { // make a note addressed to public with followers in cc note := streams.NewActivityStreamsNote() -- cgit v1.2.3