mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 08:48:53 +00:00
Merge commit '34cd7d6585992c03298c175ab5d22ad059b58cdb' into glitch-soc/merge-upstream
Conflicts: - `CONTRIBUTING.md`: Upstream changed the file, while we had a different one. Updated the common parts. - `README.md`: Upstream changed the file, while we had a different one. Updated the common parts. - `app/helpers/application_helper.rb`: Upstream added helpers where glitch-soc had extra ones. Added upstream's new helpers. - `app/models/form/admin_settings.rb`: Upstream added some custom handling of one setting, while glitch-soc had additional code. Ported upstream's code. - `lib/mastodon/version.rb`: Upstream moved some things to `config/mastodon.yml`. Did the same. - `spec/requests/api/v1/accounts/credentials_spec.rb`: I don't know honestly.
This commit is contained in:
@@ -162,12 +162,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when object publication date is below ISO8601 range' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
published: '-0977-11-03T08:31:22Z',
|
||||
}
|
||||
build_object(
|
||||
published: '-0977-11-03T08:31:22Z'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status with a valid creation date', :aggregate_failures do
|
||||
@@ -184,12 +181,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when object publication date is above ISO8601 range' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
published: '10000-11-03T08:31:22Z',
|
||||
}
|
||||
build_object(
|
||||
published: '10000-11-03T08:31:22Z'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status with a valid creation date', :aggregate_failures do
|
||||
@@ -206,13 +200,10 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when object has been edited' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
published: '2022-01-22T15:00:00Z',
|
||||
updated: '2022-01-22T16:00:00Z',
|
||||
}
|
||||
updated: '2022-01-22T16:00:00Z'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status with appropriate creation and edition dates', :aggregate_failures do
|
||||
@@ -232,13 +223,10 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when object has update date equal to creation date' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
published: '2022-01-22T15:00:00Z',
|
||||
updated: '2022-01-22T15:00:00Z',
|
||||
}
|
||||
updated: '2022-01-22T15:00:00Z'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status and does not mark it as edited' do
|
||||
@@ -254,11 +242,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with an unknown object type' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Banana',
|
||||
content: 'Lorem ipsum',
|
||||
}
|
||||
build_object(
|
||||
type: 'Banana'
|
||||
)
|
||||
end
|
||||
|
||||
it 'does not create a status' do
|
||||
@@ -267,13 +253,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
context 'with a standalone' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
}
|
||||
end
|
||||
let(:object_json) { build_object }
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
@@ -296,12 +276,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when public with explicit public address' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
}
|
||||
build_object(
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -316,12 +293,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when public with as:Public' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: 'as:Public',
|
||||
}
|
||||
build_object(
|
||||
to: 'as:Public'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -336,12 +310,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when public with Public' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: 'Public',
|
||||
}
|
||||
build_object(
|
||||
to: 'Public'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -356,12 +327,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when unlisted with explicit public address' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
cc: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
}
|
||||
build_object(
|
||||
cc: 'https://www.w3.org/ns/activitystreams#Public'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -376,12 +344,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when unlisted with as:Public' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
cc: 'as:Public',
|
||||
}
|
||||
build_object(
|
||||
cc: 'as:Public'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -396,12 +361,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when unlisted with Public' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
cc: 'Public',
|
||||
}
|
||||
build_object(
|
||||
cc: 'Public'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -416,12 +378,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when private' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: 'http://example.com/followers',
|
||||
}
|
||||
build_object(
|
||||
to: 'http://example.com/followers'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -436,16 +395,13 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when private with inlined Collection in audience' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
to: {
|
||||
type: 'OrderedCollection',
|
||||
id: 'http://example.com/followers',
|
||||
first: 'http://example.com/followers?page=true',
|
||||
},
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -462,12 +418,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
let(:recipient) { Fabricate(:account) }
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: ActivityPub::TagManager.instance.uri_for(recipient),
|
||||
}
|
||||
build_object(
|
||||
to: ActivityPub::TagManager.instance.uri_for(recipient)
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status with a silent mention' do
|
||||
@@ -512,16 +465,13 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
let(:recipient) { Fabricate(:account) }
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
to: ActivityPub::TagManager.instance.uri_for(recipient),
|
||||
tag: {
|
||||
type: 'Mention',
|
||||
href: ActivityPub::TagManager.instance.uri_for(recipient),
|
||||
},
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status with direct visibility' do
|
||||
@@ -561,12 +511,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
let(:original_status) { Fabricate(:status) }
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(original_status),
|
||||
}
|
||||
build_object(
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(original_status)
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -586,17 +533,14 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
let(:recipient) { Fabricate(:account) }
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
tag: [
|
||||
{
|
||||
type: 'Mention',
|
||||
href: ActivityPub::TagManager.instance.uri_for(recipient),
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -611,16 +555,13 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with mentions missing href' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
tag: [
|
||||
{
|
||||
type: 'Mention',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -633,10 +574,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with media attachments' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
attachment: [
|
||||
{
|
||||
type: 'Document',
|
||||
@@ -648,8 +586,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
mediaType: 'image/png',
|
||||
url: 'http://example.com/emoji.png',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status with correctly-ordered media attachments' do
|
||||
@@ -665,19 +603,16 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with media attachments with long description' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
attachment: [
|
||||
{
|
||||
type: 'Document',
|
||||
mediaType: 'image/png',
|
||||
url: 'http://example.com/attachment.png',
|
||||
name: '*' * 1500,
|
||||
name: '*' * MediaAttachment::MAX_DESCRIPTION_LENGTH,
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -686,25 +621,22 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.media_attachments.map(&:description)).to include('*' * 1500)
|
||||
expect(status.media_attachments.map(&:description)).to include('*' * MediaAttachment::MAX_DESCRIPTION_LENGTH)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with media attachments with long description as summary' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
attachment: [
|
||||
{
|
||||
type: 'Document',
|
||||
mediaType: 'image/png',
|
||||
url: 'http://example.com/attachment.png',
|
||||
summary: '*' * 1500,
|
||||
summary: '*' * MediaAttachment::MAX_DESCRIPTION_LENGTH,
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -713,16 +645,13 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.media_attachments.map(&:description)).to include('*' * 1500)
|
||||
expect(status.media_attachments.map(&:description)).to include('*' * MediaAttachment::MAX_DESCRIPTION_LENGTH)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with media attachments with focal points' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
attachment: [
|
||||
{
|
||||
type: 'Document',
|
||||
@@ -730,8 +659,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
url: 'http://example.com/attachment.png',
|
||||
focalPoint: [0.5, -0.7],
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -746,17 +675,14 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with media attachments missing url' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
attachment: [
|
||||
{
|
||||
type: 'Document',
|
||||
mediaType: 'image/png',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -769,18 +695,15 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with hashtags' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
tag: [
|
||||
{
|
||||
type: 'Hashtag',
|
||||
href: 'http://example.com/blah',
|
||||
name: '#test',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -795,10 +718,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with featured hashtags' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
tag: [
|
||||
{
|
||||
@@ -806,8 +726,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
href: 'http://example.com/blah',
|
||||
name: '#test',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
before do
|
||||
@@ -829,17 +749,14 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with hashtags missing name' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
tag: [
|
||||
{
|
||||
type: 'Hashtag',
|
||||
href: 'http://example.com/blah',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -852,18 +769,15 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with hashtags invalid name' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
tag: [
|
||||
{
|
||||
type: 'Hashtag',
|
||||
href: 'http://example.com/blah',
|
||||
name: 'foo, #eh !',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -876,9 +790,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with emojis' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
build_object(
|
||||
content: 'Lorem ipsum :tinking:',
|
||||
tag: [
|
||||
{
|
||||
@@ -888,8 +800,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
},
|
||||
name: 'tinking',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -904,9 +816,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with emojis served with invalid content-type' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
build_object(
|
||||
content: 'Lorem ipsum :tinkong:',
|
||||
tag: [
|
||||
{
|
||||
@@ -916,8 +826,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
},
|
||||
name: 'tinkong',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -932,9 +842,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with emojis missing name' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
build_object(
|
||||
content: 'Lorem ipsum :tinking:',
|
||||
tag: [
|
||||
{
|
||||
@@ -943,8 +851,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
url: 'http://example.com/emoji.png',
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -957,17 +865,15 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with emojis missing icon' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
build_object(
|
||||
content: 'Lorem ipsum :tinking:',
|
||||
tag: [
|
||||
{
|
||||
type: 'Emoji',
|
||||
name: 'tinking',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
@@ -980,8 +886,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with poll' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
build_object(
|
||||
type: 'Question',
|
||||
content: 'Which color was the submarine?',
|
||||
oneOf: [
|
||||
@@ -999,8 +904,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
totalItems: 3,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates status with a poll' do
|
||||
@@ -1023,12 +928,10 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
let!(:local_status) { Fabricate(:status, poll: poll) }
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
build_object(
|
||||
name: 'Yellow',
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status),
|
||||
}
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status)
|
||||
).except(:content)
|
||||
end
|
||||
|
||||
it 'adds a vote to the poll with correct uri' do
|
||||
@@ -1050,12 +953,10 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
let!(:local_status) { Fabricate(:status, poll: poll) }
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
build_object(
|
||||
name: 'Yellow',
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status),
|
||||
}
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status)
|
||||
).except(:content)
|
||||
end
|
||||
|
||||
it 'does not add a vote to the poll' do
|
||||
@@ -1067,10 +968,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'with counts' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
build_object(
|
||||
likes: {
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar', '/likes'].join,
|
||||
type: 'Collection',
|
||||
@@ -1080,8 +978,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar', '/shares'].join,
|
||||
type: 'Collection',
|
||||
totalItems: 100,
|
||||
},
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it 'uses the counts from the created object' do
|
||||
@@ -1110,12 +1008,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
}
|
||||
build_object(
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public'
|
||||
)
|
||||
end
|
||||
|
||||
before do
|
||||
@@ -1145,13 +1040,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
subject.perform
|
||||
end
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
}
|
||||
end
|
||||
let(:object_json) { build_object }
|
||||
|
||||
it 'creates status' do
|
||||
status = sender.statuses.first
|
||||
@@ -1166,12 +1055,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
let!(:local_status) { Fabricate(:status) }
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status),
|
||||
}
|
||||
build_object(
|
||||
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status)
|
||||
)
|
||||
end
|
||||
|
||||
before do
|
||||
@@ -1190,13 +1076,11 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
subject { described_class.new(json, sender, delivery: true) }
|
||||
|
||||
let!(:local_account) { Fabricate(:account) }
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: ActivityPub::TagManager.instance.uri_for(local_account),
|
||||
}
|
||||
build_object(
|
||||
to: ActivityPub::TagManager.instance.uri_for(local_account)
|
||||
)
|
||||
end
|
||||
|
||||
before do
|
||||
@@ -1216,12 +1100,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
let!(:local_account) { Fabricate(:account) }
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
cc: ActivityPub::TagManager.instance.uri_for(local_account),
|
||||
}
|
||||
build_object(
|
||||
cc: ActivityPub::TagManager.instance.uri_for(local_account)
|
||||
)
|
||||
end
|
||||
|
||||
before do
|
||||
@@ -1243,17 +1124,19 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
subject.perform
|
||||
end
|
||||
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
}
|
||||
end
|
||||
let(:object_json) { build_object }
|
||||
|
||||
it 'does not create anything' do
|
||||
expect(sender.statuses.count).to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
def build_object(options = {})
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
}.merge(options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user