mirror of
https://github.com/mastodon/mastodon.git
synced 2026-01-18 11:56:40 +00:00
Fix quotes with CWs but no text not having fallback link (#37361)
This commit is contained in:
parent
1fe737e0bd
commit
f711e222dc
|
|
@ -15,8 +15,6 @@ class HtmlAwareFormatter
|
|||
end
|
||||
|
||||
def to_s
|
||||
return ''.html_safe if text.blank?
|
||||
|
||||
if local?
|
||||
linkify
|
||||
else
|
||||
|
|
@ -29,6 +27,8 @@ class HtmlAwareFormatter
|
|||
private
|
||||
|
||||
def reformat
|
||||
return ''.html_safe if text.blank?
|
||||
|
||||
Sanitize.fragment(text, Sanitize::Config::MASTODON_STRICT)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ RSpec.describe '/api/v1/statuses' do
|
|||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:quote]).to be_present
|
||||
expect(response.parsed_body[:spoiler_text]).to eq 'this is a CW'
|
||||
expect(response.parsed_body[:content]).to eq ''
|
||||
expect(response.parsed_body[:content]).to match(/RE: /)
|
||||
expect(response.headers['X-RateLimit-Limit']).to eq RateLimiter::FAMILIES[:statuses][:limit].to_s
|
||||
expect(response.headers['X-RateLimit-Remaining']).to eq (RateLimiter::FAMILIES[:statuses][:limit] - 1).to_s
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,6 +19,25 @@ RSpec.describe REST::StatusSerializer do
|
|||
let(:bob) { Fabricate(:account, username: 'bob', domain: 'other.com') }
|
||||
let(:status) { Fabricate(:status, account: alice) }
|
||||
|
||||
context 'with a local status' do
|
||||
context 'with a quote and a CW but no contents' do
|
||||
let(:quoted_status) { Fabricate(:status, account: alice) }
|
||||
let(:status) { Fabricate.build(:status, account: alice, text: '', spoiler_text: 'this is a CW') }
|
||||
|
||||
before do
|
||||
Fabricate(:quote, status: status, quoted_status: quoted_status, state: :accepted)
|
||||
end
|
||||
|
||||
it 'renders the status with a CW and fallback link' do
|
||||
expect(subject)
|
||||
.to include(
|
||||
'content' => /RE: <a/,
|
||||
'spoiler_text' => 'this is a CW'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a remote status' do
|
||||
let(:status) { Fabricate(:status, account: bob) }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user