Add: 検索許可「ローカルとフォロワー」 (#60)
This commit is contained in:
parent
deb8642e95
commit
235bef36d0
24 changed files with 210 additions and 25 deletions
|
@ -67,6 +67,22 @@ describe StatusReachFinder do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when misskey with public_unlisted searchability' do
|
||||
let(:sender_software) { 'misskey' }
|
||||
let(:searchability) { :public_unlisted }
|
||||
|
||||
it 'send status without setting' do
|
||||
expect(subject.inboxes).to include 'https://foo.bar/inbox'
|
||||
expect(subject.inboxes_for_misskey).to_not include 'https://foo.bar/inbox'
|
||||
end
|
||||
|
||||
it 'send status with setting' do
|
||||
alice.user.settings.update(reject_unlisted_subscription: 'true')
|
||||
expect(subject.inboxes).to_not include 'https://foo.bar/inbox'
|
||||
expect(subject.inboxes_for_misskey).to include 'https://foo.bar/inbox'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when misskey with public searchability' do
|
||||
let(:sender_software) { 'misskey' }
|
||||
|
||||
|
|
|
@ -137,6 +137,15 @@ RSpec.describe Status do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when public-public_unlisted but silenced' do
|
||||
let(:silenced_at) { Time.now.utc }
|
||||
let(:status_searchability) { :public_unlisted }
|
||||
|
||||
it 'returns private' do
|
||||
expect(subject.compute_searchability).to eq 'private'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when public-private' do
|
||||
let(:status_searchability) { :private }
|
||||
|
||||
|
@ -215,6 +224,24 @@ RSpec.describe Status do
|
|||
expect(subject.compute_searchability).to eq 'public'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when public-public_unlisted of local account' do
|
||||
let(:account_searchability) { :public }
|
||||
let(:account_domain) { nil }
|
||||
let(:status_searchability) { :public_unlisted }
|
||||
|
||||
it 'returns public' do
|
||||
expect(subject.compute_searchability).to eq 'public'
|
||||
end
|
||||
|
||||
it 'returns public_unlisted for local' do
|
||||
expect(subject.compute_searchability_local).to eq 'public_unlisted'
|
||||
end
|
||||
|
||||
it 'returns private for activitypub' do
|
||||
expect(subject.compute_searchability_activitypub).to eq 'private'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#quote' do
|
||||
|
|
|
@ -91,18 +91,36 @@ describe TagFeed, type: :service do
|
|||
expect(results).to include status_tagged_with_cats
|
||||
end
|
||||
|
||||
it 'unlisted/public_unlisted_searchability post returns' do
|
||||
status_tagged_with_cats.update(visibility: :unlisted, searchability: :public_unlisted)
|
||||
results = described_class.new(tag_cats, nil).get(20)
|
||||
expect(results).to include status_tagged_with_cats
|
||||
end
|
||||
|
||||
it 'unlisted/public_searchability post returns with account' do
|
||||
status_tagged_with_cats.update(visibility: :unlisted, searchability: :public)
|
||||
results = described_class.new(tag_cats, account).get(20)
|
||||
expect(results).to include status_tagged_with_cats
|
||||
end
|
||||
|
||||
it 'unlisted/public_unlisted_searchability post returns with account' do
|
||||
status_tagged_with_cats.update(visibility: :unlisted, searchability: :public_unlisted)
|
||||
results = described_class.new(tag_cats, account).get(20)
|
||||
expect(results).to include status_tagged_with_cats
|
||||
end
|
||||
|
||||
it 'private post not returns' do
|
||||
status_tagged_with_cats.update(visibility: :private, searchability: :public)
|
||||
results = described_class.new(tag_cats, nil).get(20)
|
||||
expect(results).to_not include status_tagged_with_cats
|
||||
end
|
||||
|
||||
it 'private, public_unlisted post not returns' do
|
||||
status_tagged_with_cats.update(visibility: :private, searchability: :public_unlisted)
|
||||
results = described_class.new(tag_cats, nil).get(20)
|
||||
expect(results).to_not include status_tagged_with_cats
|
||||
end
|
||||
|
||||
it 'private post not returns with account' do
|
||||
status_tagged_with_cats.update(visibility: :private, searchability: :public)
|
||||
results = described_class.new(tag_cats, account).get(20)
|
||||
|
|
|
@ -63,6 +63,45 @@ describe StatusesSearchService do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when public_unlisted searchability' do
|
||||
let(:searchability) { :public_unlisted }
|
||||
let(:account) { other }
|
||||
|
||||
context 'with other account' do
|
||||
it 'search status' do
|
||||
expect(subject.count).to eq 1
|
||||
expect(subject).to include status.id
|
||||
end
|
||||
end
|
||||
|
||||
context 'with follower' do
|
||||
let(:account) { following }
|
||||
|
||||
it 'search status' do
|
||||
expect(subject.count).to eq 1
|
||||
expect(subject).to include status.id
|
||||
end
|
||||
end
|
||||
|
||||
context 'with reacted user' do
|
||||
let(:account) { reacted }
|
||||
|
||||
it 'search status' do
|
||||
expect(subject.count).to eq 1
|
||||
expect(subject).to include status.id
|
||||
end
|
||||
end
|
||||
|
||||
context 'with self' do
|
||||
let(:account) { alice }
|
||||
|
||||
it 'search status' do
|
||||
expect(subject.count).to eq 1
|
||||
expect(subject).to include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when private searchability' do
|
||||
let(:searchability) { :private }
|
||||
let(:account) { other }
|
||||
|
|
|
@ -5,9 +5,11 @@ require 'rails_helper'
|
|||
describe ActivityPub::NoteSerializer do
|
||||
subject { JSON.parse(@serialization.to_json) }
|
||||
|
||||
let(:visibility) { :public }
|
||||
let(:searchability) { :public }
|
||||
let!(:account) { Fabricate(:account) }
|
||||
let!(:other) { Fabricate(:account) }
|
||||
let!(:parent) { Fabricate(:status, account: account, visibility: :public) }
|
||||
let!(:parent) { Fabricate(:status, account: account, visibility: visibility, searchability: searchability) }
|
||||
let!(:reply_by_account_first) { Fabricate(:status, account: account, thread: parent, visibility: :public) }
|
||||
let!(:reply_by_account_next) { Fabricate(:status, account: account, thread: parent, visibility: :public) }
|
||||
let!(:reply_by_other_first) { Fabricate(:status, account: other, thread: parent, visibility: :public) }
|
||||
|
@ -46,6 +48,30 @@ describe ActivityPub::NoteSerializer do
|
|||
expect(subject['replies']['first']['items']).to_not include(reply_by_account_visibility_direct.uri)
|
||||
end
|
||||
|
||||
it 'send as public visibility' do
|
||||
expect(subject['to']).to include 'https://www.w3.org/ns/activitystreams#Public'
|
||||
end
|
||||
|
||||
context 'when public_unlisted visibility' do
|
||||
let(:visibility) { :public_unlisted }
|
||||
|
||||
it 'send as unlisted visibility' do
|
||||
expect(subject['to']).to_not include 'https://www.w3.org/ns/activitystreams#Public'
|
||||
end
|
||||
end
|
||||
|
||||
it 'send as public searchability' do
|
||||
expect(subject['searchableBy']).to include 'https://www.w3.org/ns/activitystreams#Public'
|
||||
end
|
||||
|
||||
context 'when public_unlisted searchability' do
|
||||
let(:searchability) { :public_unlisted }
|
||||
|
||||
it 'send as private searchability' do
|
||||
expect(subject['searchableBy']).to_not include 'https://www.w3.org/ns/activitystreams#Public'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when has quote but no_convert setting' do
|
||||
let(:referred) { Fabricate(:status) }
|
||||
|
||||
|
|
|
@ -363,6 +363,15 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
expect(redis).to_not have_received(:publish).with('timeline:public', anything)
|
||||
end
|
||||
|
||||
context 'with searchability public_unlisted' do
|
||||
let(:searchability) { 'public_unlisted' }
|
||||
|
||||
it 'is not broadcast to the hashtag stream' do
|
||||
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
|
||||
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge:local', anything)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with searchability private' do
|
||||
let(:searchability) { 'private' }
|
||||
|
||||
|
|
|
@ -127,6 +127,13 @@ RSpec.describe PostStatusService, type: :service do
|
|||
expect(status.searchability).to eq 'private'
|
||||
end
|
||||
|
||||
it 'creates a status with limited searchability for silenced users with public_unlisted searchability' do
|
||||
status = subject.call(Fabricate(:account, silenced: true), text: 'test', searchability: :public_unlisted, visibility: :public)
|
||||
|
||||
expect(status).to be_persisted
|
||||
expect(status.searchability).to eq 'private'
|
||||
end
|
||||
|
||||
it 'creates a status with the given searchability=public / visibility=unlisted' do
|
||||
status = create_status_with_options(searchability: :public, visibility: :unlisted)
|
||||
|
||||
|
@ -134,6 +141,13 @@ RSpec.describe PostStatusService, type: :service do
|
|||
expect(status.searchability).to eq 'public'
|
||||
end
|
||||
|
||||
it 'creates a status with the given searchability=public_unlisted / visibility=unlisted' do
|
||||
status = create_status_with_options(searchability: :public_unlisted, visibility: :unlisted)
|
||||
|
||||
expect(status).to be_persisted
|
||||
expect(status.searchability).to eq 'public_unlisted'
|
||||
end
|
||||
|
||||
it 'creates a status with the given searchability=public / visibility=private' do
|
||||
status = create_status_with_options(searchability: :public, visibility: :private)
|
||||
|
||||
|
@ -141,6 +155,13 @@ RSpec.describe PostStatusService, type: :service do
|
|||
expect(status.searchability).to eq 'private'
|
||||
end
|
||||
|
||||
it 'creates a status with the given searchability=public_unlisted / visibility=private' do
|
||||
status = create_status_with_options(searchability: :public_unlisted, visibility: :private)
|
||||
|
||||
expect(status).to be_persisted
|
||||
expect(status.searchability).to eq 'private'
|
||||
end
|
||||
|
||||
it 'creates a status for the given application' do
|
||||
application = Fabricate(:application)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue