about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2019-12-16 23:55:28 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-12-16 23:55:28 +0100
commit8094955461419661b88a0361a5d7caed4b19c29a (patch)
tree0e7a988fe2847e23a7cc0f7384b823eb9b5c9919 /spec
parent34aa5c7cb2090bf9d995eafdfbf5f9bd01336491 (diff)
Add Event activity-type support (#12637)
This adds support for Event AP type in Mastodon. Events are converted
into toots by taking their title (AS name) and their URL (AP ID). Event
picture is also brought in if available.

Testable by fetching event content from https://test.mobilizon.org

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'spec')
-rw-r--r--spec/services/activitypub/fetch_remote_status_service_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb
index 78dd59e3b..1ecc46952 100644
--- a/spec/services/activitypub/fetch_remote_status_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb
@@ -104,6 +104,26 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
       end
     end
 
+    context 'with Event object' do
+      let(:object) do
+        {
+          '@context': 'https://www.w3.org/ns/activitystreams',
+          id: "https://#{valid_domain}/@foo/1234",
+          type: 'Event',
+          name: "Let's change the world",
+          attributedTo: ActivityPub::TagManager.instance.uri_for(sender)
+        }
+      end
+
+      it 'creates status' do
+        status = sender.statuses.first
+
+        expect(status).to_not be_nil
+        expect(status.url).to eq "https://#{valid_domain}/@foo/1234"
+        expect(strip_tags(status.text)).to eq "Let's change the world https://#{valid_domain}/@foo/1234"
+      end
+    end
+
     context 'with wrong id' do
       let(:note) do
         {