Meta.allow_tag_with_these_attributes(:strong, [])
Meta.allow_tag_with_these_attributes(:sub, [])
Meta.allow_tag_with_these_attributes(:sup, [])
+ Meta.allow_tag_with_these_attributes(:ruby, [])
+ Meta.allow_tag_with_these_attributes(:rb, [])
+ Meta.allow_tag_with_these_attributes(:rp, [])
+ Meta.allow_tag_with_these_attributes(:rt, [])
+ Meta.allow_tag_with_these_attributes(:rtc, [])
Meta.allow_tag_with_these_attributes(:u, [])
Meta.allow_tag_with_these_attributes(:ul, [])
"type": "Delete",
"signature": {
"type": "RsaSignature2017",
- "signatureValue": "cw0RlfNREf+5VdsOYcCBDrv521eiLsDTAYNHKffjF0bozhCnOh+wHkFik7WamUk$
-uEiN4L2H6vPlGRprAZGRhEwgy+A7rIFQNmLrpW5qV5UNVI/2F7kngEHqZQgbQYj9hW+5GMYmPkHdv3D72ZefGw$
-4Xa2NBLGFpAjQllfzt7kzZLKKY2DM99FdUa64I2Wj3iD04Hs23SbrUdAeuGk/c1Cg6bwGNG4vxoiwn1jikgJLA$
-NAlSGjsRGdR7LfbC7GqWWsW3cSNsLFPoU6FyALjgTrrYoHiXe0QHggw+L3yMLfzB2S/L46/VRbyb+WDKMBIXUL$
-5owmzHSi6e/ZtCI3w==",
- "creator": "http://mastodon.example.org/users/gargron#main-key", "created": "2018-03-03T16:24:11Z"
+ "signatureValue": "cw0RlfNREf+5VdsOYcCBDrv521eiLsDTAYNHKffjF0bozhCnOh+wHkFik7WamUk$uEiN4L2H6vPlGRprAZGRhEwgy+A7rIFQNmLrpW5qV5UNVI/2F7kngEHqZQgbQYj9hW+5GMYmPkHdv3D72ZefGw$4Xa2NBLGFpAjQllfzt7kzZLKKY2DM99FdUa64I2Wj3iD04Hs23SbrUdAeuGk/c1Cg6bwGNG4vxoiwn1jikgJLA$NAlSGjsRGdR7LfbC7GqWWsW3cSNsLFPoU6FyALjgTrrYoHiXe0QHggw+L3yMLfzB2S/L46/VRbyb+WDKMBIXUL$5owmzHSi6e/ZtCI3w==",
+ "creator": "http://mastodon.example.org/users/gargron#main-key",
+ "created": "2018-03-03T16:24:11Z"
},
"object": {
"type": "Tombstone",
{
- "@context":[
+ "@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
"https://apfed.club/apschema/v1.4"
],
- "id":"https://apfed.club/follow/9",
- "type":"Follow",
- "actor":{
- "type":"Person",
- "id":"https://apfed.club/channel/indio",
- "preferredUsername":"indio",
- "name":"Indio",
- "updated":"2019-08-20T23:52:34Z",
- "icon":{
- "type":"Image",
- "mediaType":"image/jpeg",
- "updated":"2019-08-20T23:53:37Z",
- "url":"https://apfed.club/photo/profile/l/2",
- "height":300,
- "width":300
+ "id": "https://apfed.club/follow/9",
+ "type": "Follow",
+ "actor": {
+ "type": "Person",
+ "id": "https://apfed.club/channel/indio",
+ "preferredUsername": "indio",
+ "name": "Indio",
+ "updated": "2019-08-20T23:52:34Z",
+ "icon": {
+ "type": "Image",
+ "mediaType": "image/jpeg",
+ "updated": "2019-08-20T23:53:37Z",
+ "url": "https://apfed.club/photo/profile/l/2",
+ "height": 300,
+ "width": 300
},
- "url":"https://apfed.club/channel/indio",
- "inbox":"https://apfed.club/inbox/indio",
- "outbox":"https://apfed.club/outbox/indio",
- "followers":"https://apfed.club/followers/indio",
- "following":"https://apfed.club/following/indio",
- "endpoints":{
- "sharedInbox":"https://apfed.club/inbox"
+ "url": "https://apfed.club/channel/indio",
+ "inbox": "https://apfed.club/inbox/indio",
+ "outbox": "https://apfed.club/outbox/indio",
+ "followers": "https://apfed.club/followers/indio",
+ "following": "https://apfed.club/following/indio",
+ "endpoints": {
+ "sharedInbox": "https://apfed.club/inbox"
},
- "publicKey":{
- "id":"https://apfed.club/channel/indio",
- "owner":"https://apfed.club/channel/indio",
- "publicKeyPem":"-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA77TIR1VuSYFnmDRFGHHb\n4vaGdx9ranzRX4bfOKAqa++Ch5L4EqJpPy08RuM+NrYCYiYl4QQFDSSDXAEgb5g9\nC1TgWTfI7q/E0UBX2Vr0mU6X4i1ztv0tuQvegRjcSJ7l1AvoBs8Ip4MEJ3OPEQhB\ngJqAACB3Gnps4zi2I0yavkxUfGVKr6zKT3BxWh5hTpKC7Do+ChIrVZC2EwxND9K6
-\nsAnQHThcb5EQuvuzUQZKeS7IEOsd0JpZDmJjbfMGrAWE81pLIfEeeA2joCJiBBTO\nglDsW+juvZ+lWqJpMr2hMWpvfrFjJeUawNJCIzsLdVIZR+aKj5yy6yqoS8hkN9Ha\n1MljZpsXl+EmwcwAIqim1YeLwERCEAQ/JWbSt8pQTQbzZ6ibwQ4mchCxacrRbIVR
-\nnL59fWMBassJcbY0VwrTugm2SBsYbDjESd55UZV03Rwr8qseGTyi+hH8O7w2SIaY\nzjN6AdZiPmsh00YflzlCk8MSLOHMol1vqIUzXxU8CdXn9+KsuQdZGrTz0YKN/db4\naVwUGJatz2Tsvf7R1tJBjJfeQWOWbbn3pycLVH86LjZ83qngp9ZVnAveUnUqz0yS
-\nhe+buZ6UMsfGzbIYon2bKNlz6gYTH0YPcr+cLe+29drtt0GZiXha1agbpo4RB8zE
-\naNL2fucF5YT0yNpbd/5WoV0CAwEAAQ==\n-----END PUBLIC KEY-----\n"
+ "publicKey": {
+ "id": "https://apfed.club/channel/indio",
+ "owner": "https://apfed.club/channel/indio",
+ "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA77TIR1VuSYFnmDRFGHHb\n4vaGdx9ranzRX4bfOKAqa++Ch5L4EqJpPy08RuM+NrYCYiYl4QQFDSSDXAEgb5g9\nC1TgWTfI7q/E0UBX2Vr0mU6X4i1ztv0tuQvegRjcSJ7l1AvoBs8Ip4MEJ3OPEQhB\ngJqAACB3Gnps4zi2I0yavkxUfGVKr6zKT3BxWh5hTpKC7Do+ChIrVZC2EwxND9K6\nsAnQHThcb5EQuvuzUQZKeS7IEOsd0JpZDmJjbfMGrAWE81pLIfEeeA2joCJiBBTO\nglDsW+juvZ+lWqJpMr2hMWpvfrFjJeUawNJCIzsLdVIZR+aKj5yy6yqoS8hkN9Ha\n1MljZpsXl+EmwcwAIqim1YeLwERCEAQ/JWbSt8pQTQbzZ6ibwQ4mchCxacrRbIVR\nnL59fWMBassJcbY0VwrTugm2SBsYbDjESd55UZV03Rwr8qseGTyi+hH8O7w2SIaY\nzjN6AdZiPmsh00YflzlCk8MSLOHMol1vqIUzXxU8CdXn9+KsuQdZGrTz0YKN/db4\naVwUGJatz2Tsvf7R1tJBjJfeQWOWbbn3pycLVH86LjZ83qngp9ZVnAveUnUqz0yS\nhe+buZ6UMsfGzbIYon2bKNlz6gYTH0YPcr+cLe+29drtt0GZiXha1agbpo4RB8zE\naNL2fucF5YT0yNpbd/5WoV0CAwEAAQ==\n-----END PUBLIC KEY-----\n"
}
},
- "object":"https://pleroma.site/users/kaniini",
- "to":[
+ "object": "https://pleroma.site/users/kaniini",
+ "to": [
"https://pleroma.site/users/kaniini"
],
- "signature":{
- "@context":[
+ "signature": {
+ "@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1"
],
- "type":"RsaSignature2017",
- "nonce":"52c035e0a9e81dce8b486159204e97c22637e91f75cdfad5378de91de68e9117",
- "creator":"https://apfed.club/channel/indio/public_key_pem",
- "created":"2019-08-22T03:38:02Z",
- "signatureValue":"oVliRCIqNIh6yUp851dYrF0y21aHp3Rz6VkIpW1pFMWfXuzExyWSfcELpyLseeRmsw5bUu9zJkH44B4G2LiJQKA9UoEQDjrDMZBmbeUpiQqq3DVUzkrBOI8bHZ7xyJ/CjSZcNHHh0MHhSKxswyxWMGi4zIqzkAZG3vRRgoPVHdjPm00sR3B8jBLw1cjoffv+KKeM/zEUpe13gqX9qHAWHHqZepxgSWmq+EKOkRvHUPBXiEJZfXzc5uW+vZ09F3WBYmaRoy8Y0e1P29fnRLqSy7EEINdrHaGclRqoUZyiawpkgy3lWWlynesV/HiLBR7EXT79eKstxf4wfTDaPKBCfTCsOWuMWHr7Genu37ew2/t7eiBGqCwwW12ylhml/OLHgNK3LOhmRABhtfpaFZSxfDVnlXfaLpY1xekVOj2oC0FpBtnoxVKLpIcyLw6dkfSil5ANd+hl59W/bpPA8KT90ii1fSNCo3+FcwQVx0YsPznJNA60XfFuVsme7zNcOst6393e1WriZxBanFpfB63zVQc9u1fjyfktx/yiUNxIlre+sz9OCc0AACn94iRhBYh4bbzdleUOTnM7lnD4Dj2FP+xeDIP8CA8wXUeq5+9kopSp2kAmlUEyFUdg4no7naIeu1SZnopfUg56PsVCp9JHiUK1SYAyWbdC+FbUECu5CvI="
+ "type": "RsaSignature2017",
+ "nonce": "52c035e0a9e81dce8b486159204e97c22637e91f75cdfad5378de91de68e9117",
+ "creator": "https://apfed.club/channel/indio/public_key_pem",
+ "created": "2019-08-22T03:38:02Z",
+ "signatureValue": "oVliRCIqNIh6yUp851dYrF0y21aHp3Rz6VkIpW1pFMWfXuzExyWSfcELpyLseeRmsw5bUu9zJkH44B4G2LiJQKA9UoEQDjrDMZBmbeUpiQqq3DVUzkrBOI8bHZ7xyJ/CjSZcNHHh0MHhSKxswyxWMGi4zIqzkAZG3vRRgoPVHdjPm00sR3B8jBLw1cjoffv+KKeM/zEUpe13gqX9qHAWHHqZepxgSWmq+EKOkRvHUPBXiEJZfXzc5uW+vZ09F3WBYmaRoy8Y0e1P29fnRLqSy7EEINdrHaGclRqoUZyiawpkgy3lWWlynesV/HiLBR7EXT79eKstxf4wfTDaPKBCfTCsOWuMWHr7Genu37ew2/t7eiBGqCwwW12ylhml/OLHgNK3LOhmRABhtfpaFZSxfDVnlXfaLpY1xekVOj2oC0FpBtnoxVKLpIcyLw6dkfSil5ANd+hl59W/bpPA8KT90ii1fSNCo3+FcwQVx0YsPznJNA60XfFuVsme7zNcOst6393e1WriZxBanFpfB63zVQc9u1fjyfktx/yiUNxIlre+sz9OCc0AACn94iRhBYh4bbzdleUOTnM7lnD4Dj2FP+xeDIP8CA8wXUeq5+9kopSp2kAmlUEyFUdg4no7naIeu1SZnopfUg56PsVCp9JHiUK1SYAyWbdC+FbUECu5CvI="
}
}
describe "/inbox" do
test "it inserts an incoming activity into the database", %{conn: conn} do
- data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!()
conn =
conn
data =
File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", user.ap_id)
|> put_in(["object", "attridbutedTo"], user.ap_id)
end
test "it clears `unreachable` federation status of the sender", %{conn: conn} do
- data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!()
sender_url = data["actor"]
Instances.set_consistently_unreachable(sender_url)
test "without valid signature, " <>
"it only accepts Create activities and requires enabled federation",
%{conn: conn} do
- data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
- non_create_data = File.read!("test/fixtures/mastodon-announce.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!()
+ non_create_data = File.read!("test/fixtures/mastodon-announce.json") |> Jason.decode!()
conn = put_req_header(conn, "content-type", "application/activity+json")
setup do
data =
File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
[data: data]
end
data =
File.read!("test/fixtures/activitypub-client-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
object = Map.put(data["object"], "attributedTo", actor.ap_id)
defp get_old_message do
File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
end
defp get_new_message do
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
object =
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
|> Map.put("object", follow_activity.data["id"])
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
accept_data =
end
test "it works for incoming announces with actor being inlined (kroeg)" do
- data = File.read!("test/fixtures/kroeg-announce-with-inline-actor.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/kroeg-announce-with-inline-actor.json") |> Jason.decode!()
_user = insert(:user, local: false, ap_id: data["actor"]["id"])
other_user = insert(:user)
test "it works for incoming announces, fetching the announced object" do
data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", "http://mastodon.example.org/users/admin/statuses/99541947525187367")
Tesla.Mock.mock(fn
data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_user = insert(:user, local: false, ap_id: data["actor"])
test "it works for incoming announces with an inlined activity" do
data =
File.read!("test/fixtures/mastodon-announce-private.json")
- |> Poison.decode!()
+ |> Jason.decode!()
_user =
insert(:user,
data =
File.read!("test/fixtures/bogus-mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
_user = insert(:user, local: false, ap_id: data["actor"])
data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", Object.normalize(activity).data["id"])
|> Map.put("to", ["http://mastodon.example.org/users/admin/followers"])
|> Map.put("cc", [])
data =
File.read!("test/fixtures/mastodon-vote.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["to"], user.ap_id)
|> Kernel.put_in(["object", "inReplyTo"], object.data["id"])
|> Kernel.put_in(["object", "to"], user.ap_id)
# TODO: Replace with CommonAPI vote creation when implemented
data =
File.read!("test/fixtures/mastodon-vote.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["to"], user.ap_id)
|> Kernel.put_in(["object", "inReplyTo"], poll_object.data["id"])
|> Kernel.put_in(["object", "to"], user.ap_id)
}
end)
- data = File.read!("test/fixtures/tesla_mock/funkwhale_create_audio.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/tesla_mock/funkwhale_create_audio.json") |> Jason.decode!()
{:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
data =
File.read!("test/fixtures/mastodon-block-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
blocker = insert(:user, ap_id: data["actor"])
data =
File.read!("test/fixtures/mastodon-block-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", blocked.ap_id)
|> Map.put("actor", blocker.ap_id)
test "it rejects messages that don't contain content" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
object =
data["object"]
test "it rejects messages that don't concern local users" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
_author =
insert(:user, ap_id: data["actor"], local: false, last_refreshed_at: DateTime.utc_now())
test "it rejects messages where the `to` field of activity and object don't match" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
author = insert(:user, ap_id: data["actor"])
_recipient = insert(:user, ap_id: List.first(data["to"]))
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", "http://mastodon.example.org/users/admin")
|> put_in(["object", "actor"], "http://mastodon.example.org/users/admin")
test "it doesn't work for deactivated users" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
_author =
insert(:user,
test "it inserts it and creates a chat" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
author =
insert(:user, ap_id: data["actor"], local: false, last_refreshed_at: DateTime.utc_now())
data =
File.read!("test/fixtures/mastodon-delete.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", deleting_user.ap_id)
|> put_in(["object", "id"], activity.data["object"])
data =
File.read!("test/fixtures/mastodon-delete.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", deleting_user.ap_id)
|> put_in(["object", "id"], activity.data["object"])
data =
File.read!("test/fixtures/mastodon-delete.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", ap_id)
|> put_in(["object", "id"], activity.data["object"])
data =
File.read!("test/fixtures/mastodon-delete-user.json")
- |> Poison.decode!()
+ |> Jason.decode!()
{:ok, _} = Transmogrifier.handle_incoming(data)
ObanHelpers.perform_all()
data =
File.read!("test/fixtures/mastodon-delete-user.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", ap_id)
assert match?({:error, _}, Transmogrifier.handle_incoming(data))
data =
File.read!("test/fixtures/emoji-reaction.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("actor", other_user.ap_id)
data =
File.read!("test/fixtures/emoji-reaction-too-long.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("actor", other_user.ap_id)
data =
File.read!("test/fixtures/emoji-reaction-no-emoji.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("actor", other_user.ap_id)
data =
File.read!("test/fixtures/osada-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: data, local: false} = activity} = Transmogrifier.handle_incoming(data)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: data, local: false} = activity} = Transmogrifier.handle_incoming(data)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(data)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("id", String.replace(data["id"], "2", "3"))
|> Map.put("object", user.ap_id)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: %{"id" => id}}} = Transmogrifier.handle_incoming(data)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
with_mock Pleroma.User, [:passthrough], follow: fn _, _, _ -> {:error, :testing} end do
data =
File.read!("test/fixtures/hubzilla-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
|> Utils.normalize_params()
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
data =
File.read!("test/fixtures/mastodon-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_actor = insert(:user, ap_id: data["actor"], local: false)
data =
File.read!("test/fixtures/misskey-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_actor = insert(:user, ap_id: data["actor"], local: false)
data =
File.read!("test/fixtures/misskey-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("_misskey_reaction", "⭐")
end
test "Mastodon Question activity" do
- data = File.read!("test/fixtures/mastodon-question-activity.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-question-activity.json") |> Jason.decode!()
{:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
data =
File.read!("test/fixtures/mastodon-question-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["object", "oneOf"], options)
{:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
data =
File.read!("test/fixtures/mastodon-question-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["object", "oneOf"], options)
|> Kernel.put_in(["object", "tag"], tag)
end
test "returns same activity if received a second time" do
- data = File.read!("test/fixtures/mastodon-question-activity.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-question-activity.json") |> Jason.decode!()
assert {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
test "accepts a Question with no content" do
data =
File.read!("test/fixtures/mastodon-question-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["object", "content"], "")
assert {:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(data)
accept_data =
File.read!("test/fixtures/mastodon-reject-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
accept_data =
reject_data =
File.read!("test/fixtures/mastodon-reject-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
|> Map.put("object", follow_activity.data["id"])
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
|> Map.put("id", "")
data =
File.read!("test/fixtures/mastodon-undo-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", reaction_activity.data["id"])
|> Map.put("actor", user.ap_id)
data =
File.read!("test/fixtures/mastodon-undo-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
assert Transmogrifier.handle_incoming(data) == :error
like_data =
File.read!("test/fixtures/mastodon-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_liker = insert(:user, ap_id: like_data["actor"], local: false)
data =
File.read!("test/fixtures/mastodon-undo-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", like_data)
|> Map.put("actor", like_data["actor"])
like_data =
File.read!("test/fixtures/mastodon-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_liker = insert(:user, ap_id: like_data["actor"], local: false)
data =
File.read!("test/fixtures/mastodon-undo-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", like_data["id"])
|> Map.put("actor", like_data["actor"])
announce_data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_announcer = insert(:user, ap_id: announce_data["actor"], local: false)
data =
File.read!("test/fixtures/mastodon-undo-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", announce_data)
|> Map.put("actor", announce_data["actor"])
follow_data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
_follower = insert(:user, ap_id: follow_data["actor"], local: false)
data =
File.read!("test/fixtures/mastodon-unfollow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", follow_data)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
block_data =
File.read!("test/fixtures/mastodon-block-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
_blocker = insert(:user, ap_id: block_data["actor"], local: false)
data =
File.read!("test/fixtures/mastodon-unblock-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", block_data)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
test "it works for incoming update activities" do
user = insert(:user, local: false)
- update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!()
+ update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!()
object =
update_data["object"]
{:ok, _activity} =
"test/fixtures/mastodon-update.json"
|> File.read!()
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", actor)
|> Map.update!("object", fn object ->
object
assert user.fields == []
- update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!()
+ update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!()
object =
update_data["object"]
test "it works for incoming update activities which lock the account" do
user = insert(:user, local: false)
- update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!()
+ update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!()
object =
update_data["object"]
follow_data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: _, local: false}} = Transmogrifier.handle_incoming(follow_data)
data =
File.read!("test/fixtures/mastodon-unfollow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", follow_data)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
params =
File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
assert {:ok, job} = Federator.incoming_ap_doc(params)
assert {:error, _} = ObanHelpers.perform(job)
redirect_query = URI.parse(redirected_to(conn)).query
assert %{"state" => state_param} = URI.decode_query(redirect_query)
- assert {:ok, state_components} = Poison.decode(state_param)
+ assert {:ok, state_components} = Jason.decode(state_param)
expected_client_id = app.client_id
expected_redirect_uri = app.redirect_uris
"oauth_token" => "G-5a3AAAAAAAwMH9AAABaektfSM",
"oauth_verifier" => "QZl8vUqNvXMTKpdmUnGejJxuHG75WWWs",
"provider" => "twitter",
- "state" => Poison.encode!(state_params)
+ "state" => Jason.encode!(state_params)
}
)
"oauth_token" => "G-5a3AAAAAAAwMH9AAABaektfSM",
"oauth_verifier" => "QZl8vUqNvXMTKpdmUnGejJxuHG75WWWs",
"provider" => "twitter",
- "state" => Poison.encode!(state_params)
+ "state" => Jason.encode!(state_params)
}
)
"oauth_token" => "G-5a3AAAAAAAwMH9AAABaektfSM",
"oauth_verifier" => "QZl8vUqNvXMTKpdmUnGejJxuHG75WWWs",
"provider" => "twitter",
- "state" => Poison.encode!(state_params)
+ "state" => Jason.encode!(state_params)
}
)
data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("actor", user.ap_id)
assigns = Map.new(assigns)
view.render(template, assigns)
- |> Poison.encode!()
- |> Poison.decode!()
+ |> Jason.encode!()
+ |> Jason.decode!()
end
def stringify_keys(nil), do: nil