Skip to content

Commit

Permalink
Fix: DistributionWorkerでString to Integerのエラーが出る問題 (#344)
Browse files Browse the repository at this point in the history
* Fix: DeliveryWorkerでString to Integerのエラーが出る問題

* Test: Mastodon v3向け
  • Loading branch information
kmycode authored Dec 11, 2023
1 parent 709e19c commit 3e8b475
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/instance_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def self.fetch_emoji_reaction_available(domain)
return false if info.nil?

return true if EMOJI_REACTION_AVAILABLE_SOFTWARES.include?(info['software'])
return false if info.data['metadata'].nil? || !info.data['metadata'].is_a?(Hash)

features = info.data.dig('metadata', 'features')
return false if features.nil? || !features.is_a?(Array)
Expand Down
7 changes: 6 additions & 1 deletion spec/models/status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@
describe '.emoji_reaction_availables_map' do
subject { described_class.emoji_reaction_availables_map(domains) }

let(:domains) { %w(features_available.com features_unavailable.com features_invalid.com features_nil.com no_info.com mastodon.com misskey.com) }
let(:domains) { %w(features_available.com features_unavailable.com features_invalid.com features_nil.com no_info.com mastodon.com misskey.com old_mastodon.com) }

before do
Fabricate(:instance_info, domain: 'features_available.com', software: 'mastodon', data: { metadata: { features: ['emoji_reaction'] } })
Expand All @@ -472,6 +472,7 @@
Fabricate(:instance_info, domain: 'features_nil.com', software: 'mastodon', data: { metadata: { features: nil } })
Fabricate(:instance_info, domain: 'mastodon.com', software: 'mastodon')
Fabricate(:instance_info, domain: 'misskey.com', software: 'misskey')
Fabricate(:instance_info, domain: 'old_mastodon.com', software: 'mastodon', data: { metadata: [] })
end

it 'availables if features contains emoji_reaction' do
Expand All @@ -497,6 +498,10 @@
it 'availables if misskey server' do
expect(subject['misskey.com']).to be true
end

it 'unavailables if old mastodon server' do
expect(subject['old_mastodon.com']).to be false
end
end

describe '.tagged_with' do
Expand Down

0 comments on commit 3e8b475

Please sign in to comment.