Merge remote-tracking branch 'parent/main' into upstream-20241203

This commit is contained in:
KMY 2024-12-03 18:03:14 +09:00
commit 2d9124a3ab
214 changed files with 1763 additions and 3380 deletions

View file

@ -165,6 +165,7 @@ RSpec.describe FeedManager do
allow(List).to receive(:where).and_return(list)
status = Fabricate(:status, text: 'I post a lot', account: bob)
expect(subject.filter?(:home, status, alice)).to be true
expect(subject.filter(:home, status, alice)).to be :skip_home
end
it 'returns true for reblog from followee on exclusive list' do
@ -175,6 +176,7 @@ RSpec.describe FeedManager do
status = Fabricate(:status, text: 'I post a lot', account: bob)
reblog = Fabricate(:status, reblog: status, account: jeff)
expect(subject.filter?(:home, reblog, alice)).to be true
expect(subject.filter(:home, reblog, alice)).to be :skip_home
end
it 'returns false for post from followee on non-exclusive list' do

View file

@ -57,5 +57,25 @@ RSpec.describe Sanitize::Config do
it 'keeps a with supported scheme and no host' do
expect(Sanitize.fragment('<a href="dweb:/a/foo">Test</a>', subject)).to eq '<a href="dweb:/a/foo" rel="nofollow noopener noreferrer" target="_blank">Test</a>'
end
it 'sanitizes math to LaTeX' do
mathml = '<math><semantics><mrow><msup><mi>x</mi><mi>n</mi></msup><mo>+</mo><mi>y</mi></mrow><annotation encoding="application/x-tex">x^n+y</annotation></semantics></math>'
expect(Sanitize.fragment(mathml, subject)).to eq '$x^n+y$'
end
it 'sanitizes math blocks to LaTeX' do
mathml = '<math display="block"><semantics><mrow><msup><mi>x</mi><mi>n</mi></msup><mo>+</mo><mi>y</mi></mrow><annotation encoding="application/x-tex">x^n+y</annotation></semantics></math>'
expect(Sanitize.fragment(mathml, subject)).to eq '$$x^n+y$$'
end
it 'math sanitizer falls back to plaintext' do
mathml = '<math><semantics><msqrt><mi>x</mi></msqrt><annotation encoding="text/plain">sqrt(x)</annotation></semantics></math>'
expect(Sanitize.fragment(mathml, subject)).to eq 'sqrt(x)'
end
it 'prefers latex' do
mathml = '<math><semantics><msqrt><mi>x</mi></msqrt><annotation encoding="text/plain">sqrt(x)</annotation><annotation encoding="application/x-tex">\\sqrt x</annotation></semantics></math>'
expect(Sanitize.fragment(mathml, subject)).to eq '$\sqrt x$'
end
end
end