Merge branch 'kb_lts' into kb_development

This commit is contained in:
KMY 2023-09-25 19:39:27 +09:00
commit fc923c4d9b
5 changed files with 72 additions and 1 deletions

View file

@ -11,6 +11,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
let(:software) { 'mastodon' }
let(:searchable_by) { 'https://www.w3.org/ns/activitystreams#Public' }
let(:sender_bio) { '' }
let(:indexable) { nil }
let(:payload) do
{
id: 'https://foo.test',
@ -18,6 +19,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
inbox: 'https://foo.test/inbox',
followers: 'https://example.com/followers',
searchableBy: searchable_by,
indexable: indexable,
summary: sender_bio,
}.with_indifferent_access
end
@ -73,6 +75,39 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
it 'searchability is public' do
expect(subject.searchability).to eq 'public'
end
context 'with true indexable' do
let(:indexable) { true }
it 'searchability is public' do
expect(subject.searchability).to eq 'public'
end
end
context 'with false indexable' do
let(:indexable) { false }
it 'searchability is limited' do
expect(subject.searchability).to eq 'limited'
end
end
context 'with no-indexable key' do
let(:payload) do
{
id: 'https://foo.test',
type: 'Actor',
inbox: 'https://foo.test/inbox',
followers: 'https://example.com/followers',
searchableBy: searchable_by,
summary: sender_bio,
}.with_indifferent_access
end
it 'searchability is public' do
expect(subject.searchability).to eq 'public'
end
end
end
context 'with bio' do

View file

@ -206,6 +206,27 @@ RSpec.describe PostStatusService, type: :service do
expect(status.mentioned_accounts.first.id).to eq circle_account.id
end
it 'circle post with limited visibility' do
account = Fabricate(:account)
circle_account = Fabricate(:account)
circle = Fabricate(:circle, account: account)
text = 'This is an English text.'
circle_account.follow!(account)
circle.accounts << circle_account
status = subject.call(account, text: text, visibility: 'limited', circle_id: circle.id)
expect(status.visibility).to eq 'limited'
expect(status.limited_scope).to eq 'circle'
end
it 'limited visibility and empty circle' do
account = Fabricate(:account)
text = 'This is an English text.'
expect { subject.call(account, text: text, visibility: 'limited') }.to raise_exception ActiveRecord::RecordInvalid
end
it 'safeguards mentions' do
account = Fabricate(:account)
mentioned_account = Fabricate(:account, username: 'alice')