Skip to content

Commit

Permalink
Fix: #89 NodeInfo向けの機能一覧表を作成して区別
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Oct 12, 2023
1 parent 5cb8cca commit 8d9ff90
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
25 changes: 25 additions & 0 deletions app/helpers/kmyblue_capabilities_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,29 @@ def fedibird_capabilities

capabilities
end

def capabilities_for_nodeinfo
capabilities = %i(
wide_emoji
status_reference
quote
kmyblue_quote
searchability
kmyblue_searchability
visibility_mutual
visibility_limited
kmyblue_antenna
kmyblue_bookmark_category
kmyblue_searchability_limited
kmyblue_circle_history
)

capabilities << :full_text_search if Chewy.enabled?
if Setting.enable_emoji_reaction
capabilities << :emoji_reaction
capabilities << :enable_wide_emoji_reaction
end

capabilities
end
end
2 changes: 1 addition & 1 deletion app/serializers/nodeinfo/serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def open_registrations

def metadata
{
features: fedibird_capabilities,
features: capabilities_for_nodeinfo,
}
end

Expand Down
5 changes: 5 additions & 0 deletions spec/serializers/nodeinfo/serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@
it 'returns features' do
expect(serialization['metadata']['features']).to include 'emoji_reaction'
end

it 'returns nodeinfo own features' do
expect(serialization['metadata']['features']).to include 'quote'
expect(serialization['metadata']['features']).to_not include 'kmyblue_markdown'
end
end
end
4 changes: 4 additions & 0 deletions spec/serializers/rest/instance_serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
it 'returns fedibird_capabilities' do
expect(serialization['fedibird_capabilities']).to include 'emoji_reaction'
end

it 'returns api own fedibird_capabilities' do
expect(serialization['fedibird_capabilities']).to include 'kmyblue_markdown'
end
end
end

0 comments on commit 8d9ff90

Please sign in to comment.