From 6823ae3baef1cfeaf0a924b7b4fca0a4b0b490fe Mon Sep 17 00:00:00 2001 From: KMY Date: Wed, 11 Oct 2023 09:40:04 +0900 Subject: [PATCH] =?UTF-8?q?#79=20`LocalPublic`=E3=82=92`kmyblue:LocalPubli?= =?UTF-8?q?c`=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lib/activitypub/parser/status_parser.rb | 4 ++-- app/lib/activitypub/tag_manager.rb | 4 ++-- spec/lib/activitypub/activity/create_spec.rb | 16 ++++++++-------- spec/lib/activitypub/tag_manager_spec.rb | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/lib/activitypub/parser/status_parser.rb b/app/lib/activitypub/parser/status_parser.rb index 16c6c00424e719..af2033cf12e676 100644 --- a/app/lib/activitypub/parser/status_parser.rb +++ b/app/lib/activitypub/parser/status_parser.rb @@ -77,7 +77,7 @@ def sensitive 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 @@ def searchability_from_audience :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 diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index 8258b146356f2e..f0322672803488 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -128,7 +128,7 @@ def to(status) 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 @@ def searchable_by(status) 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 diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 93b953fa34924e..7659ed82a00155 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -236,13 +236,13 @@ 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 @@ 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 @@ 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 @@ 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 diff --git a/spec/lib/activitypub/tag_manager_spec.rb b/spec/lib/activitypub/tag_manager_spec.rb index e69214f2ca89e7..9878952f05dfc0 100644 --- a/spec/lib/activitypub/tag_manager_spec.rb +++ b/spec/lib/activitypub/tag_manager_spec.rb @@ -77,7 +77,7 @@ 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 @@ 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