Merge commit 'faed9bf9f1
' into kb-draft-15.8-lts
This commit is contained in:
commit
be6dc25206
23 changed files with 313 additions and 107 deletions
|
@ -11,9 +11,11 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
|
|||
[
|
||||
{ type: 'Hashtag', name: 'hoge' },
|
||||
{ type: 'Mention', href: ActivityPub::TagManager.instance.uri_for(alice) },
|
||||
{ type: 'Mention', href: bogus_mention },
|
||||
]
|
||||
end
|
||||
let(:content) { 'Hello universe' }
|
||||
let(:bogus_mention) { 'https://example.com/users/erroringuser' }
|
||||
let(:payload) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
|
@ -36,19 +38,21 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
|
|||
let(:media_attachments) { [] }
|
||||
|
||||
before do
|
||||
mentions.each { |a| Fabricate(:mention, status: status, account: a) }
|
||||
mentions.each { |(account, silent)| Fabricate(:mention, status: status, account: account, silent: silent) }
|
||||
tags.each { |t| status.tags << t }
|
||||
media_attachments.each { |m| status.media_attachments << m }
|
||||
stub_request(:get, bogus_mention).to_raise(HTTP::ConnectionError)
|
||||
end
|
||||
|
||||
describe '#call' do
|
||||
it 'updates text and content warning' do
|
||||
it 'updates text and content warning, and schedules re-fetching broken mention' do
|
||||
subject.call(status, json, json)
|
||||
expect(status.reload)
|
||||
.to have_attributes(
|
||||
text: eq('Hello universe'),
|
||||
spoiler_text: eq('Show more')
|
||||
)
|
||||
expect(MentionResolveWorker).to have_enqueued_sidekiq_job(status.id, bogus_mention, anything)
|
||||
end
|
||||
|
||||
context 'when the changes are only in sanitized-out HTML' do
|
||||
|
@ -320,7 +324,19 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
|
|||
end
|
||||
|
||||
context 'when originally with mentions' do
|
||||
let(:mentions) { [alice, bob] }
|
||||
let(:mentions) { [[alice, false], [bob, false]] }
|
||||
|
||||
before do
|
||||
subject.call(status, json, json)
|
||||
end
|
||||
|
||||
it 'updates mentions' do
|
||||
expect(status.active_mentions.reload.map(&:account_id)).to eq [alice.id]
|
||||
end
|
||||
end
|
||||
|
||||
context 'when originally with silent mentions' do
|
||||
let(:mentions) { [[alice, true], [bob, true]] }
|
||||
|
||||
before do
|
||||
subject.call(status, json, json)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue