1
0
Fork 0
forked from gitea/nas

独自機能の追加などで他の部分への影響が分かるようにCI周りの修正 (#1)

* Fix EmojiFormatter failure

* Add notification_emails.warning setting default value

* Fix list spec failure and add antennas for spec response

* Fix domain block spec failure to add kb custom response

* Fix SearchQueryTransformer spec failure

* Fix Account#matches_display_name spec failure

* Fix UpdateStatusService changes mentions spec failure

* Fix RuboCop Lint

* Ignore brakeman warning

* Fix CI failure for ignore brakeman warning

* Fix migration failure

* Fix README

* Fix migration CI failure

* Fix some spec failure

* Format code for RuboCop lint failure

* Fix ESlint failure

* Fix haml-lint failure
This commit is contained in:
S.H 2023-08-07 21:38:15 +09:00 committed by GitHub
parent b5949f8e48
commit 696e4a10d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 347 additions and 113 deletions

View file

@ -26,7 +26,7 @@ RSpec.describe EmojiFormatter do
let(:text) { preformat_text(':coolcat: Beep boop') }
it 'converts the shortcode to an image tag' do
expect(subject).to match(/<img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
expect(subject).to match(/<img rel="emoji" draggable="false" height="16" class="emojione custom-emoji" style="min-width:16px;" alt=":coolcat:"/)
end
end
@ -34,7 +34,7 @@ RSpec.describe EmojiFormatter do
let(:text) { preformat_text('Beep :coolcat: boop') }
it 'converts the shortcode to an image tag' do
expect(subject).to match(/Beep <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
expect(subject).to match(/Beep <img rel="emoji" draggable="false" height="16" class="emojione custom-emoji" style="min-width:16px;" alt=":coolcat:"/)
end
end
@ -50,7 +50,7 @@ RSpec.describe EmojiFormatter do
let(:text) { preformat_text('Beep boop :coolcat:') }
it 'converts the shortcode to an image tag' do
expect(subject).to match(/boop <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
expect(subject).to match(/boop <img rel="emoji" draggable="false" height="16" class="emojione custom-emoji" style="min-width:16px;" alt=":coolcat:"/)
end
end
end

View file

@ -9,7 +9,7 @@ describe SearchQueryTransformer do
it 'sets attributes' do
transformer = described_class.new.apply(parser)
expect(transformer.should_clauses.first).to be_a(SearchQueryTransformer::TermClause)
expect(transformer.should_clauses.first).to be_a(SearchQueryTransformer::PhraseClause)
expect(transformer.must_clauses.first).to be_nil
expect(transformer.must_not_clauses.first).to be_nil
expect(transformer.filter_clauses.first).to be_nil

View file

@ -843,18 +843,18 @@ RSpec.describe Account do
describe 'matches_display_name' do
it 'matches display name which starts with the given string' do
match = Fabricate(:account, display_name: 'pattern and suffix')
Fabricate(:account, display_name: 'prefix and pattern')
account = Fabricate(:account, display_name: 'prefix and pattern')
expect(described_class.matches_display_name('pattern')).to eq [match]
expect(described_class.matches_display_name('pattern')).to eq [match, account]
end
end
describe 'matches_username' do
it 'matches display name which starts with the given string' do
match = Fabricate(:account, username: 'pattern_and_suffix')
Fabricate(:account, username: 'prefix_and_pattern')
account = Fabricate(:account, username: 'prefix_and_pattern')
expect(described_class.matches_username('pattern')).to eq [match]
expect(described_class.matches_username('pattern')).to eq [match, account]
end
end

View file

@ -60,10 +60,38 @@ RSpec.describe 'Domain Blocks' do
end
end
let(:expected_responde_with_kb_custom) do
domain_blocks.map do |domain_block|
{
id: domain_block.id.to_s,
domain: domain_block.domain,
created_at: domain_block.created_at.strftime('%Y-%m-%dT%H:%M:%S.%LZ'),
severity: domain_block.severity.to_s,
reject_media: domain_block.reject_media,
reject_reports: domain_block.reject_reports,
private_comment: domain_block.private_comment,
public_comment: domain_block.public_comment,
obfuscate: domain_block.obfuscate,
reject_favourite: domain_block.reject_favourite,
reject_hashtag: domain_block.reject_hashtag,
detect_invalid_subscription: domain_block.detect_invalid_subscription,
reject_new_follow: domain_block.reject_new_follow,
reject_reply: domain_block.reject_reply,
reject_reply_exclude_followers: domain_block.reject_reply_exclude_followers,
reject_send_dissubscribable: domain_block.reject_send_dissubscribable,
reject_send_media: domain_block.reject_send_media,
reject_send_not_public_searchability: domain_block.reject_send_not_public_searchability,
reject_send_public_unlisted: domain_block.reject_send_public_unlisted,
reject_send_sensitive: domain_block.reject_send_sensitive,
reject_straight_follow: domain_block.reject_straight_follow,
}
end
end
it 'returns the expected domain blocks' do
subject
expect(body_as_json).to match_array(expected_responde)
expect(body_as_json).to match_array(expected_responde_with_kb_custom)
end
context 'with limit param' do
@ -85,6 +113,32 @@ RSpec.describe 'Domain Blocks' do
let!(:domain_block) { Fabricate(:domain_block) }
let(:expected_response) do
{
id: domain_block.id.to_s,
domain: domain_block.domain,
created_at: domain_block.created_at.strftime('%Y-%m-%dT%H:%M:%S.%LZ'),
severity: domain_block.severity.to_s,
reject_media: domain_block.reject_media,
reject_reports: domain_block.reject_reports,
private_comment: domain_block.private_comment,
public_comment: domain_block.public_comment,
obfuscate: domain_block.obfuscate,
reject_favourite: domain_block.reject_favourite,
reject_hashtag: domain_block.reject_hashtag,
detect_invalid_subscription: domain_block.detect_invalid_subscription,
reject_new_follow: domain_block.reject_new_follow,
reject_reply: domain_block.reject_reply,
reject_reply_exclude_followers: domain_block.reject_reply_exclude_followers,
reject_send_dissubscribable: domain_block.reject_send_dissubscribable,
reject_send_media: domain_block.reject_send_media,
reject_send_not_public_searchability: domain_block.reject_send_not_public_searchability,
reject_send_public_unlisted: domain_block.reject_send_public_unlisted,
reject_send_sensitive: domain_block.reject_send_sensitive,
reject_straight_follow: domain_block.reject_straight_follow,
}
end
it_behaves_like 'forbidden for wrong scope', 'write:statuses'
it_behaves_like 'forbidden for wrong role', ''
it_behaves_like 'forbidden for wrong role', 'Moderator'
@ -98,19 +152,7 @@ RSpec.describe 'Domain Blocks' do
it 'returns the expected domain block content' do
subject
expect(body_as_json).to eq(
{
id: domain_block.id.to_s,
domain: domain_block.domain,
created_at: domain_block.created_at.strftime('%Y-%m-%dT%H:%M:%S.%LZ'),
severity: domain_block.severity.to_s,
reject_media: domain_block.reject_media,
reject_reports: domain_block.reject_reports,
private_comment: domain_block.private_comment,
public_comment: domain_block.public_comment,
obfuscate: domain_block.obfuscate,
}
)
expect(body_as_json).to eq(expected_response)
end
context 'when the requested domain block does not exist' do

View file

@ -33,6 +33,18 @@ RSpec.describe 'Lists' do
end
end
let(:expected_response_with_antennas) do
lists.map do |list|
{
id: list.id.to_s,
title: list.title,
replies_policy: list.replies_policy,
exclusive: list.exclusive,
antennas: list.antennas,
}
end
end
before do
Fabricate(:list)
end
@ -48,7 +60,7 @@ RSpec.describe 'Lists' do
it 'returns the expected lists' do
subject
expect(body_as_json).to match_array(expected_response)
expect(body_as_json).to match_array(expected_response_with_antennas)
end
end
@ -75,6 +87,7 @@ RSpec.describe 'Lists' do
title: list.title,
replies_policy: list.replies_policy,
exclusive: list.exclusive,
antennas: list.antennas,
})
end
@ -171,6 +184,7 @@ RSpec.describe 'Lists' do
title: list.title,
replies_policy: list.replies_policy,
exclusive: list.exclusive,
antennas: list.antennas,
})
end

View file

@ -21,7 +21,7 @@ describe 'Content-Security-Policy' do
"child-src 'self' blob: https://cb6e6126.ngrok.io",
"worker-src 'self' blob: https://cb6e6126.ngrok.io",
"connect-src 'self' data: blob: https://cb6e6126.ngrok.io https://cb6e6126.ngrok.io ws://localhost:4000",
"script-src 'self' https://cb6e6126.ngrok.io 'wasm-unsafe-eval'"
"script-src 'self' https://cb6e6126.ngrok.io 'wasm-unsafe-eval' https://www.googletagmanager.com https://googleads.g.doubleclick.net https://www.googleadservices.com https://www.google.co.jp https://www.google.com 'sha256-CS1WvLDd3zJOdxpEk+N+VigcWMa6V345p2HS0WYiFWE='"
)
end
end