소스 검색

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>
master^2
Thomas Citharel 4 년 전
committed by Eugen Rochko
부모
커밋
8094955461
2개의 변경된 파일21개의 추가작업 그리고 1개의 파일을 삭제
  1. +1
    -1
      app/lib/activitypub/activity.rb
  2. +20
    -0
      spec/services/activitypub/fetch_remote_status_service_spec.rb

+ 1
- 1
app/lib/activitypub/activity.rb 파일 보기

@@ -5,7 +5,7 @@ class ActivityPub::Activity
include Redisable

SUPPORTED_TYPES = %w(Note Question).freeze
CONVERTED_TYPES = %w(Image Audio Video Article Page).freeze
CONVERTED_TYPES = %w(Image Audio Video Article Page Event).freeze

def initialize(json, account, **options)
@json = json


+ 20
- 0
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
{


불러오는 중...
취소
저장