|
|
|
|
@ -37,6 +37,37 @@ RSpec.describe ActivityPub::Activity::Flag do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'when the report comment is excessively long' do |
|
|
|
|
subject do |
|
|
|
|
described_class.new({ |
|
|
|
|
'@context': 'https://www.w3.org/ns/activitystreams', |
|
|
|
|
id: flag_id, |
|
|
|
|
type: 'Flag', |
|
|
|
|
content: long_comment, |
|
|
|
|
actor: ActivityPub::TagManager.instance.uri_for(sender), |
|
|
|
|
object: [ |
|
|
|
|
ActivityPub::TagManager.instance.uri_for(flagged), |
|
|
|
|
ActivityPub::TagManager.instance.uri_for(status), |
|
|
|
|
], |
|
|
|
|
}.with_indifferent_access, sender) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
let(:long_comment) { Faker::Lorem.characters(number: 6000) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
subject.perform |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'creates a report but with a truncated comment' do |
|
|
|
|
report = Report.find_by(account: sender, target_account: flagged) |
|
|
|
|
|
|
|
|
|
expect(report).to_not be_nil |
|
|
|
|
expect(report.comment.length).to eq 5000 |
|
|
|
|
expect(report.comment).to eq long_comment[0...5000] |
|
|
|
|
expect(report.status_ids).to eq [status.id] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'when the reported status is private and should not be visible to the remote server' do |
|
|
|
|
let(:status) { Fabricate(:status, account: flagged, uri: 'foobar', visibility: :private) } |
|
|
|
|
|
|
|
|
|
|