summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin Joshi <satchin.joshi@gmail.com>2019-04-02 10:26:09 +0545
committerSachin Joshi <satchin.joshi@gmail.com>2019-04-02 10:26:09 +0545
commit6386c1c9c1ff971c784744922a479ae38e5fdbad (patch)
tree03db21b0991906a6b334b9e88217da8bb2d71400
parent1d01e8e656c364b97b9ee36a6173a830d3f5f4fc (diff)
downloadpleroma-6386c1c9c1ff971c784744922a479ae38e5fdbad.tar.gz
pleroma-6386c1c9c1ff971c784744922a479ae38e5fdbad.zip
fetch url for OStatus to know if it is a/c or status
-rw-r--r--lib/pleroma/web/twitter_api/controllers/util_controller.ex6
-rw-r--r--test/fixtures/httpoison_mock/emelie.atom306
-rw-r--r--test/fixtures/httpoison_mock/emelie.json106
-rw-r--r--test/fixtures/httpoison_mock/webfinger_emelie.json36
-rw-r--r--test/support/http_request_mock.ex21
-rw-r--r--test/web/twitter_api/util_controller_test.exs10
6 files changed, 377 insertions, 108 deletions
diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
index 7f301a518..2a1c73111 100644
--- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex
+++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
@@ -103,8 +103,10 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
end
defp is_status?(acct) do
- %URI{path: path} = URI.parse(acct)
- Regex.match?(~r/\/users\/[^\/]+\/statuses\/([0-9]+)$/, path)
+ case ActivityPub.fetch_and_contain_remote_object_from_id(acct) do
+ {:ok, %{"type" => "Note"}} -> true
+ _ -> false
+ end
end
def do_remote_follow(conn, %{
diff --git a/test/fixtures/httpoison_mock/emelie.atom b/test/fixtures/httpoison_mock/emelie.atom
new file mode 100644
index 000000000..ddaa1c6ca
--- /dev/null
+++ b/test/fixtures/httpoison_mock/emelie.atom
@@ -0,0 +1,306 @@
+<?xml version="1.0"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:media="http://purl.org/syndication/atommedia" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:mastodon="http://mastodon.social/schema/1.0">
+ <id>https://mastodon.social/users/emelie.atom</id>
+ <title>emelie 🎨</title>
+ <subtitle>23 / #Sweden / #Artist / #Equestrian / #GameDev
+
+If I ain't spending time with my pets, I'm probably drawing. 🐴 🐱 🐰</subtitle>
+ <updated>2019-02-04T20:22:19Z</updated>
+ <logo>https://files.mastodon.social/accounts/avatars/000/015/657/original/e7163f98280da1a4.png</logo>
+ <author>
+ <id>https://mastodon.social/users/emelie</id>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
+ <uri>https://mastodon.social/users/emelie</uri>
+ <name>emelie</name>
+ <email>emelie@mastodon.social</email>
+ <summary type="html">&lt;p&gt;23 / &lt;a href="https://mastodon.social/tags/sweden" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;Sweden&lt;/span&gt;&lt;/a&gt; / &lt;a href="https://mastodon.social/tags/artist" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;Artist&lt;/span&gt;&lt;/a&gt; / &lt;a href="https://mastodon.social/tags/equestrian" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;Equestrian&lt;/span&gt;&lt;/a&gt; / &lt;a href="https://mastodon.social/tags/gamedev" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;GameDev&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;If I ain&amp;apos;t spending time with my pets, I&amp;apos;m probably drawing. 🐴 🐱 🐰&lt;/p&gt;</summary>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie"/>
+ <link rel="avatar" type="image/png" media:width="120" media:height="120" href="https://files.mastodon.social/accounts/avatars/000/015/657/original/e7163f98280da1a4.png"/>
+ <link rel="header" type="image/png" media:width="700" media:height="335" href="https://files.mastodon.social/accounts/headers/000/015/657/original/847f331f3dd9e38b.png"/>
+ <poco:preferredUsername>emelie</poco:preferredUsername>
+ <poco:displayName>emelie 🎨</poco:displayName>
+ <poco:note>23 / #Sweden / #Artist / #Equestrian / #GameDev
+
+If I ain't spending time with my pets, I'm probably drawing. 🐴 🐱 🐰</poco:note>
+ <mastodon:scope>public</mastodon:scope>
+ </author>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie.atom"/>
+ <link rel="hub" href="https://mastodon.social/api/push"/>
+ <link rel="salmon" href="https://mastodon.social/api/salmon/15657"/>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101850331907006641</id>
+ <published>2019-04-01T09:58:50Z</published>
+ <updated>2019-04-01T09:58:50Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101850331907006641"/>
+ <content type="html" xml:lang="en">&lt;p&gt;Me: I&amp;apos;m going to make this vital change to my world building in the morning, no way I&amp;apos;ll forget this, it&amp;apos;s too big of a deal&lt;br /&gt;Also me: forgets&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101850331907006641"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17854598.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-04-01:objectId=94383214:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101849626603073336</id>
+ <published>2019-04-01T06:59:28Z</published>
+ <updated>2019-04-01T06:59:28Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/comment</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101849626603073336"/>
+ <content type="html" xml:lang="sv">&lt;p&gt;&lt;span class="h-card"&gt;&lt;a href="https://mastodon.social/@Fergant" class="u-url mention"&gt;@&lt;span&gt;Fergant&lt;/span&gt;&lt;/a&gt;&lt;/span&gt; Dom är i stort sett religiös skrift vid det här laget 👏👏&lt;/p&gt;&lt;p&gt;har dock bara läst svenska översättningen, kanske är dags att jag läser dom på engelska&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="https://mastodon.social/users/Fergant"/>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101849626603073336"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17852590.atom"/>
+ <thr:in-reply-to ref="https://mastodon.social/users/Fergant/statuses/101849606513357387" href="https://mastodon.social/@Fergant/101849606513357387"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-04-01:objectId=94362529:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101849580030237068</id>
+ <published>2019-04-01T06:47:37Z</published>
+ <updated>2019-04-01T06:47:37Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101849580030237068"/>
+ <content type="html" xml:lang="en">&lt;p&gt;What&amp;apos;s you people&amp;apos;s favourite fantasy books? Give me some hot tips 🌞&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101849580030237068"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17852464.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-04-01:objectId=94362529:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101849550599949363</id>
+ <published>2019-04-01T06:40:08Z</published>
+ <updated>2019-04-01T06:40:08Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101849550599949363"/>
+ <content type="html" xml:lang="en">&lt;p&gt;Stick them legs out 💃 &lt;a href="https://mastodon.social/tags/mastocats" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;mastocats&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <category term="mastocats"/>
+ <link rel="enclosure" type="image/jpeg" length="516384" href="https://files.mastodon.social/media_attachments/files/013/051/707/original/125a310abe9a34aa.jpeg"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101849550599949363"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17852407.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-04-01:objectId=94361580:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101849191533152720</id>
+ <published>2019-04-01T05:08:49Z</published>
+ <updated>2019-04-01T05:08:49Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101849191533152720"/>
+ <content type="html" xml:lang="en">&lt;p&gt;long 🐱 &lt;a href="https://mastodon.social/tags/mastocats" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;mastocats&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <category term="mastocats"/>
+ <link rel="enclosure" type="image/jpeg" length="305208" href="https://files.mastodon.social/media_attachments/files/013/049/940/original/f2dbbfe7de3a17d2.jpeg"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101849191533152720"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17851663.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-04-01:objectId=94351141:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101849165031453009</id>
+ <published>2019-04-01T05:02:05Z</published>
+ <updated>2019-04-01T05:02:05Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101849165031453009"/>
+ <content type="html" xml:lang="en">&lt;p&gt;You gotta take whatever bellyrubbing opportunity you can get before she changes her mind 🦁 &lt;a href="https://mastodon.social/tags/mastocats" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;mastocats&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <category term="mastocats"/>
+ <link rel="enclosure" type="video/mp4" length="9838915" href="https://files.mastodon.social/media_attachments/files/013/049/816/original/e7831178a5e0d6d4.mp4"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101849165031453009"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17851558.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-04-01:objectId=94350309:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101846512530748693</id>
+ <published>2019-03-31T17:47:31Z</published>
+ <updated>2019-03-31T17:47:31Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101846512530748693"/>
+ <content type="html" xml:lang="en">&lt;p&gt;Hello look at this boy having a decent haircut for once &lt;a href="https://mastodon.social/tags/mastohorses" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;mastohorses&lt;/span&gt;&lt;/a&gt; &lt;a href="https://mastodon.social/tags/equestrian" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;equestrian&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <category term="equestrian"/>
+ <category term="mastohorses"/>
+ <link rel="enclosure" type="image/jpeg" length="461632" href="https://files.mastodon.social/media_attachments/files/013/033/387/original/301e8ab668cd61d2.jpeg"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101846512530748693"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17842424.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-31:objectId=94256415:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101846181093805500</id>
+ <published>2019-03-31T16:23:14Z</published>
+ <updated>2019-03-31T16:23:14Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101846181093805500"/>
+ <content type="html" xml:lang="en">&lt;p&gt;Sorry did I disturb the who-is-the-longest-cat competition ? &lt;a href="https://mastodon.social/tags/mastocats" class="mention hashtag" rel="tag"&gt;#&lt;span&gt;mastocats&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <category term="mastocats"/>
+ <link rel="enclosure" type="image/jpeg" length="211384" href="https://files.mastodon.social/media_attachments/files/013/030/725/original/5b4886730cbbd25c.jpeg"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101846181093805500"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17841108.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-31:objectId=94245239:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101845897513133849</id>
+ <published>2019-03-31T15:11:07Z</published>
+ <updated>2019-03-31T15:11:07Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101845897513133849"/>
+ <summary xml:lang="en">more earthsea ramblings</summary>
+ <content type="html" xml:lang="en">&lt;p&gt;I&amp;apos;m re-watching Tales from Earthsea for the first time since I read the books, and that Therru doesn&amp;apos;t squash Cob like a spider, as Orm Embar did is a wasted opportunity tbh&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101845897513133849"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17840088.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-31:objectId=94232455:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101841219051533307</id>
+ <published>2019-03-30T19:21:19Z</published>
+ <updated>2019-03-30T19:21:19Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101841219051533307"/>
+ <content type="html" xml:lang="en">&lt;p&gt;I gave my cats some mackerel and they ate it all in 0.3 seconds, and now they won&amp;apos;t stop meowing for more, and I&amp;apos;m tired plz shut up&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101841219051533307"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17826587.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-30:objectId=94075000:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101839949762341381</id>
+ <published>2019-03-30T13:58:31Z</published>
+ <updated>2019-03-30T13:58:31Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/comment</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101839949762341381"/>
+ <content type="html" xml:lang="en">&lt;p&gt;yet I&amp;apos;m confused about this american dude with a gun, like the heck r ya doin in mah ghibli&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101839949762341381"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17821757.atom"/>
+ <thr:in-reply-to ref="https://mastodon.social/users/emelie/statuses/101839928677863590" href="https://mastodon.social/@emelie/101839928677863590"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-30:objectId=94026360:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101839928677863590</id>
+ <published>2019-03-30T13:53:09Z</published>
+ <updated>2019-03-30T13:53:09Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101839928677863590"/>
+ <content type="html" xml:lang="en">&lt;p&gt;2 hours into Ni no Kuni 2 and I&amp;apos;ve already sold my soul to this game&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101839928677863590"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17821713.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-30:objectId=94026360:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101836329521599438</id>
+ <published>2019-03-29T22:37:51Z</published>
+ <updated>2019-03-29T22:37:51Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101836329521599438"/>
+ <content type="html" xml:lang="en">&lt;p&gt;Pippi Longstocking the original one-punch /man&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101836329521599438"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17811608.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-29:objectId=93907854:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101835905282948341</id>
+ <published>2019-03-29T20:49:57Z</published>
+ <updated>2019-03-29T20:49:57Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101835905282948341"/>
+ <content type="html" xml:lang="en">&lt;p&gt;I&amp;apos;ve had so much wine I thought I had a 3rd brother&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101835905282948341"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17809862.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-29:objectId=93892966:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101835878059204660</id>
+ <published>2019-03-29T20:43:02Z</published>
+ <updated>2019-03-29T20:43:02Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101835878059204660"/>
+ <content type="html" xml:lang="en">&lt;p&gt;ååååhhh booi&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101835878059204660"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17809734.atom"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-29:objectId=93892010:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101835848050598939</id>
+ <published>2019-03-29T20:35:24Z</published>
+ <updated>2019-03-29T20:35:24Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/comment</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101835848050598939"/>
+ <content type="html" xml:lang="en">&lt;p&gt;&lt;span class="h-card"&gt;&lt;a href="https://thraeryn.net/@thraeryn" class="u-url mention"&gt;@&lt;span&gt;thraeryn&lt;/span&gt;&lt;/a&gt;&lt;/span&gt; if I spent 1 hour and a half watching this monstrosity, I need to&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="https://thraeryn.net/users/thraeryn"/>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101835848050598939"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17809591.atom"/>
+ <thr:in-reply-to ref="https://thraeryn.net/users/thraeryn/statuses/101835839202826007" href="https://thraeryn.net/@thraeryn/101835839202826007"/>
+ <ostatus:conversation ref="tag:mastodon.social,2019-03-29:objectId=93888827:objectType=Conversation"/>
+ </entry>
+ <entry>
+ <id>https://mastodon.social/users/emelie/statuses/101835823138262290</id>
+ <published>2019-03-29T20:29:04Z</published>
+ <updated>2019-03-29T20:29:04Z</updated>
+ <title>New status by emelie</title>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/comment</activity:object-type>
+ <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
+ <link rel="alternate" type="application/activity+json" href="https://mastodon.social/users/emelie/statuses/101835823138262290"/>
+ <summary xml:lang="en">medical, fluids mention</summary>
+ <content type="html" xml:lang="en">&lt;p&gt;&lt;span class="h-card"&gt;&lt;a href="https://icosahedron.website/@Trev" class="u-url mention"&gt;@&lt;span&gt;Trev&lt;/span&gt;&lt;/a&gt;&lt;/span&gt; *hugs* ✨&lt;/p&gt;</content>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="https://icosahedron.website/users/Trev"/>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <mastodon:scope>public</mastodon:scope>
+ <link rel="alternate" type="text/html" href="https://mastodon.social/@emelie/101835823138262290"/>
+ <link rel="self" type="application/atom+xml" href="https://mastodon.social/users/emelie/updates/17809468.atom"/>
+ <thr:in-reply-to ref="https://icosahedron.website/users/Trev/statuses/101835812250051801" href="https://icosahedron.website/@Trev/101835812250051801"/>
+ <ostatus:conversation ref="tag:icosahedron.website,2019-03-29:objectId=12220882:objectType=Conversation"/>
+ </entry>
+</feed>
diff --git a/test/fixtures/httpoison_mock/emelie.json b/test/fixtures/httpoison_mock/emelie.json
deleted file mode 100644
index 2e164ffdf..000000000
--- a/test/fixtures/httpoison_mock/emelie.json
+++ /dev/null
@@ -1,106 +0,0 @@
-{
- "@context": [
- "https://www.w3.org/ns/activitystreams",
- "https://w3id.org/security/v1",
- {
- "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
- "toot": "http://joinmastodon.org/ns#",
- "featured": {
- "@id": "toot:featured",
- "@type": "@id"
- },
- "alsoKnownAs": {
- "@id": "as:alsoKnownAs",
- "@type": "@id"
- },
- "movedTo": {
- "@id": "as:movedTo",
- "@type": "@id"
- },
- "schema": "http://schema.org#",
- "PropertyValue": "schema:PropertyValue",
- "value": "schema:value",
- "Hashtag": "as:Hashtag",
- "Emoji": "toot:Emoji",
- "IdentityProof": "toot:IdentityProof",
- "focalPoint": {
- "@container": "@list",
- "@id": "toot:focalPoint"
- }
- }
- ],
- "id": "https://mastodon.social/users/emelie",
- "type": "Person",
- "following": "https://mastodon.social/users/emelie/following",
- "followers": "https://mastodon.social/users/emelie/followers",
- "inbox": "https://mastodon.social/users/emelie/inbox",
- "outbox": "https://mastodon.social/users/emelie/outbox",
- "featured": "https://mastodon.social/users/emelie/collections/featured",
- "preferredUsername": "emelie",
- "name": "emelie 🎨",
- "summary": "<p>23 / <a href=\"https://mastodon.social/tags/sweden\" class=\"mention hashtag\" rel=\"tag\">#<span>Sweden</span></a> / <a href=\"https://mastodon.social/tags/artist\" class=\"mention hashtag\" rel=\"tag\">#<span>Artist</span></a> / <a href=\"https://mastodon.social/tags/equestrian\" class=\"mention hashtag\" rel=\"tag\">#<span>Equestrian</span></a> / <a href=\"https://mastodon.social/tags/gamedev\" class=\"mention hashtag\" rel=\"tag\">#<span>GameDev</span></a></p><p>If I ain&apos;t spending time with my pets, I&apos;m probably drawing. 🐴 🐱 🐰</p>",
- "url": "https://mastodon.social/@emelie",
- "manuallyApprovesFollowers": false,
- "publicKey": {
- "id": "https://mastodon.social/users/emelie#main-key",
- "owner": "https://mastodon.social/users/emelie",
- "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu3CWs1oAJPE3ZJ9sj6Ut\n/Mu+mTE7MOijsQc8/6c73XVVuhIEomiozJIH7l8a7S1n5SYL4UuiwcubSOi7u1bb\nGpYnp5TYhN+Cxvq/P80V4/ncNIPSQzS49it7nSLeG5pA21lGPDA44huquES1un6p\n9gSmbTwngVX9oe4MYuUeh0Z7vijjU13Llz1cRq/ZgPQPgfz+2NJf+VeXnvyDZDYx\nZPVBBlrMl3VoGbu0M5L8SjY35559KCZ3woIvqRolcoHXfgvJMdPcJgSZVYxlCw3d\nA95q9jQcn6s87CPSUs7bmYEQCrDVn5m5NER5TzwBmP4cgJl9AaDVWQtRd4jFZNTx\nlQIDAQAB\n-----END PUBLIC KEY-----\n"
- },
- "tag": [
- {
- "type": "Hashtag",
- "href": "https://mastodon.social/explore/sweden",
- "name": "#sweden"
- },
- {
- "type": "Hashtag",
- "href": "https://mastodon.social/explore/gamedev",
- "name": "#gamedev"
- },
- {
- "type": "Hashtag",
- "href": "https://mastodon.social/explore/artist",
- "name": "#artist"
- },
- {
- "type": "Hashtag",
- "href": "https://mastodon.social/explore/equestrian",
- "name": "#equestrian"
- }
- ],
- "attachment": [
- {
- "type": "PropertyValue",
- "name": "Ko-fi",
- "value": "<a href=\"https://ko-fi.com/emeliepng\" rel=\"me nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">ko-fi.com/emeliepng</span><span class=\"invisible\"></span></a>"
- },
- {
- "type": "PropertyValue",
- "name": "Instagram",
- "value": "<a href=\"https://www.instagram.com/emelie_png/\" rel=\"me nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://www.</span><span class=\"\">instagram.com/emelie_png/</span><span class=\"invisible\"></span></a>"
- },
- {
- "type": "PropertyValue",
- "name": "Carrd",
- "value": "<a href=\"https://emelie.carrd.co/\" rel=\"me nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">emelie.carrd.co/</span><span class=\"invisible\"></span></a>"
- },
- {
- "type": "PropertyValue",
- "name": "Artstation",
- "value": "<a href=\"https://emiri.artstation.com\" rel=\"me nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">emiri.artstation.com</span><span class=\"invisible\"></span></a>"
- }
- ],
- "endpoints": {
- "sharedInbox": "https://mastodon.social/inbox"
- },
- "icon": {
- "type": "Image",
- "mediaType": "image/png",
- "url": "https://files.mastodon.social/accounts/avatars/000/015/657/original/e7163f98280da1a4.png"
- },
- "image": {
- "type": "Image",
- "mediaType": "image/png",
- "url": "https://files.mastodon.social/accounts/headers/000/015/657/original/847f331f3dd9e38b.png"
- }
-}
diff --git a/test/fixtures/httpoison_mock/webfinger_emelie.json b/test/fixtures/httpoison_mock/webfinger_emelie.json
new file mode 100644
index 000000000..0b61cb618
--- /dev/null
+++ b/test/fixtures/httpoison_mock/webfinger_emelie.json
@@ -0,0 +1,36 @@
+{
+ "aliases": [
+ "https://mastodon.social/@emelie",
+ "https://mastodon.social/users/emelie"
+ ],
+ "links": [
+ {
+ "href": "https://mastodon.social/@emelie",
+ "rel": "http://webfinger.net/rel/profile-page",
+ "type": "text/html"
+ },
+ {
+ "href": "https://mastodon.social/users/emelie.atom",
+ "rel": "http://schemas.google.com/g/2010#updates-from",
+ "type": "application/atom+xml"
+ },
+ {
+ "href": "https://mastodon.social/users/emelie",
+ "rel": "self",
+ "type": "application/activity+json"
+ },
+ {
+ "href": "https://mastodon.social/api/salmon/15657",
+ "rel": "salmon"
+ },
+ {
+ "href": "data:application/magic-public-key,RSA.u3CWs1oAJPE3ZJ9sj6Ut_Mu-mTE7MOijsQc8_6c73XVVuhIEomiozJIH7l8a7S1n5SYL4UuiwcubSOi7u1bbGpYnp5TYhN-Cxvq_P80V4_ncNIPSQzS49it7nSLeG5pA21lGPDA44huquES1un6p9gSmbTwngVX9oe4MYuUeh0Z7vijjU13Llz1cRq_ZgPQPgfz-2NJf-VeXnvyDZDYxZPVBBlrMl3VoGbu0M5L8SjY35559KCZ3woIvqRolcoHXfgvJMdPcJgSZVYxlCw3dA95q9jQcn6s87CPSUs7bmYEQCrDVn5m5NER5TzwBmP4cgJl9AaDVWQtRd4jFZNTxlQ==.AQAB",
+ "rel": "magic-public-key"
+ },
+ {
+ "rel": "http://ostatus.org/schema/1.0/subscribe",
+ "template": "https://mastodon.social/authorize_interaction?uri={uri}"
+ }
+ ],
+ "subject": "acct:emelie@mastodon.social"
+}
diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex
index 2148bd4e7..d3b547d91 100644
--- a/test/support/http_request_mock.ex
+++ b/test/support/http_request_mock.ex
@@ -53,6 +53,27 @@ defmodule HttpRequestMock do
end
def get(
+ "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/emelie",
+ _,
+ _,
+ _
+ ) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/httpoison_mock/webfinger_emelie.json")
+ }}
+ end
+
+ def get("https://mastodon.social/users/emelie.atom", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/httpoison_mock/emelie.atom")
+ }}
+ end
+
+ def get(
"https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com",
_,
_,
diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs
index f4a3ce501..e4dd97d46 100644
--- a/test/web/twitter_api/util_controller_test.exs
+++ b/test/web/twitter_api/util_controller_test.exs
@@ -180,5 +180,15 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
assert redirected_to(conn) =~ "/notice/"
end
+
+ test "show follow account page if the `acct` is a account link", %{conn: conn} do
+ response =
+ get(
+ conn,
+ "/ostatus_subscribe?acct=https://mastodon.social/users/emelie"
+ )
+
+ assert html_response(response, 200) =~ "Log in to follow"
+ end
end
end