#79 LocalPublickmyblue:LocalPublicに変更

This commit is contained in:
KMY 2023-10-11 09:40:04 +09:00
parent d93c64b6e1
commit 6823ae3bae
4 changed files with 14 additions and 14 deletions

View file

@ -77,7 +77,7 @@ class ActivityPub::Parser::StatusParser
def visibility
if audience_to.any? { |to| ActivityPub::TagManager.instance.public_collection?(to) }
:public
elsif audience_to.include?('LocalPublic') && @friend
elsif audience_to.include?('kmyblue:LocalPublic') && @friend
:public_unlisted
elsif audience_cc.any? { |cc| ActivityPub::TagManager.instance.public_collection?(cc) }
:unlisted
@ -201,7 +201,7 @@ class ActivityPub::Parser::StatusParser
:public
elsif audience_searchable_by.include?('kmyblue:Limited') || audience_searchable_by.include?('as:Limited')
:limited
elsif audience_searchable_by.include?('LocalPublic') && @friend
elsif audience_searchable_by.include?('kmyblue:LocalPublic') && @friend
:public_unlisted
elsif audience_searchable_by.include?(@account.followers_url)
:private

View file

@ -128,7 +128,7 @@ class ActivityPub::TagManager
def to_for_friend(status)
to = to(status)
to << 'LocalPublic' if status.public_unlisted_visibility?
to << 'kmyblue:LocalPublic' if status.public_unlisted_visibility?
to
end
@ -259,7 +259,7 @@ class ActivityPub::TagManager
def searchable_by_for_friend(status)
searchable = searchable_by(status)
searchable << 'LocalPublic' if status.compute_searchability_local == 'public_unlisted'
searchable << 'kmyblue:LocalPublic' if status.compute_searchability_local == 'public_unlisted'
searchable
end

View file

@ -236,13 +236,13 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'when public_unlisted with LocalPublic' do
context 'when public_unlisted with kmyblue:LocalPublic' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: 'Lorem ipsum',
to: ['http://example.com/followers', 'LocalPublic'],
to: ['http://example.com/followers', 'kmyblue:LocalPublic'],
cc: 'https://www.w3.org/ns/activitystreams#Public',
}
end
@ -255,13 +255,13 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'when public_unlisted with LocalPublic from friend-server' do
context 'when public_unlisted with kmyblue:LocalPublic from friend-server' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: 'Lorem ipsum',
to: ['http://example.com/followers', 'LocalPublic'],
to: ['http://example.com/followers', 'kmyblue:LocalPublic'],
cc: 'https://www.w3.org/ns/activitystreams#Public',
}
end
@ -452,8 +452,8 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'with public_unlisted with LocalPublic' do
let(:searchable_by) { ['http://example.com/followers', 'LocalPublic'] }
context 'with public_unlisted with kmyblue:LocalPublic' do
let(:searchable_by) { ['http://example.com/followers', 'kmyblue:LocalPublic'] }
it 'create status' do
status = sender.statuses.first
@ -463,8 +463,8 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'with public_unlisted with LocalPublic from friend-server' do
let(:searchable_by) { ['http://example.com/followers', 'LocalPublic'] }
context 'with public_unlisted with kmyblue:LocalPublic from friend-server' do
let(:searchable_by) { ['http://example.com/followers', 'kmyblue:LocalPublic'] }
let(:active_friend) { true }
it 'create status' do

View file

@ -77,7 +77,7 @@ RSpec.describe ActivityPub::TagManager do
describe '#to_for_friend' do
it 'returns followers collection for public_unlisted status' do
status = Fabricate(:status, visibility: :public_unlisted)
expect(subject.to_for_friend(status)).to eq [account_followers_url(status.account), 'LocalPublic']
expect(subject.to_for_friend(status)).to eq [account_followers_url(status.account), 'kmyblue:LocalPublic']
end
it 'returns followers collection for unlisted status' do
@ -200,7 +200,7 @@ RSpec.describe ActivityPub::TagManager do
it 'returns public collection for public_unlisted status' do
status = Fabricate(:status, account: Fabricate(:account, searchability: :public), searchability: :public_unlisted)
expect(subject.searchable_by_for_friend(status)).to eq [account_followers_url(status.account), 'LocalPublic']
expect(subject.searchable_by_for_friend(status)).to eq [account_followers_url(status.account), 'kmyblue:LocalPublic']
end
it 'returns followers collection for private status' do