Skip to content

Commit e14f182

Browse files
committed
Fetch only non blocked pesons
1 parent dc4483a commit e14f182

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

Gemfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ group :development do
251251
gem "rubocop", "0.93.1", require: false
252252
gem "rubocop-rails", "2.9.1", require: false
253253

254-
254+
# Debugging
255+
gem "pry"
256+
gem "pry-byebug"
255257

256258
# test coverage
257259
gem "simplecov", "0.21.2", require: false
@@ -303,8 +305,4 @@ group :development, :test do
303305

304306
# For `assigns` in controller specs
305307
gem "rails-controller-testing", "1.0.4"
306-
307-
# Debugging
308-
gem "pry"
309-
gem "pry-byebug"
310308
end

config/initializers/diaspora_federation.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
config.define_callbacks do
1616
on :fetch_person_for_webfinger do |diaspora_id|
1717
person = Person.where(diaspora_handle: diaspora_id, closed_account: false).where.not(owner: nil).first
18-
if person
18+
unless person.nil? || person.closed_account?
1919
DiasporaFederation::Discovery::WebFinger.new(
2020
{
2121
acct_uri: "acct:#{person.diaspora_handle}",
@@ -39,7 +39,7 @@
3939

4040
on :fetch_person_for_hcard do |guid|
4141
person = Person.where(guid: guid, closed_account: false).where.not(owner: nil).take
42-
if person
42+
unless person.nil? || person.closed_account?
4343
DiasporaFederation::Discovery::HCard.new(
4444
guid: person.guid,
4545
nickname: person.username,
@@ -111,13 +111,15 @@
111111
when DiasporaFederation::Entities::Retraction
112112
Diaspora::Federation::Receive.retraction(entity, recipient_id)
113113
else
114+
# TODO: Check for person.closed_account? when merging with #8228 'Block Pod'
114115
persisted = Diaspora::Federation::Receive.perform(entity)
115116
Workers::ReceiveLocal.perform_async(persisted.class.to_s, persisted.id, [recipient_id].compact) if persisted
116117
end
117118
end
118119

119120
on :fetch_public_entity do |entity_type, guid|
120121
entity = Diaspora::Federation::Mappings.model_class_for(entity_type).all_public.find_by(guid: guid)
122+
# TODO: Check for person.closed_account? when merging with #8228 'Block Pod'
121123
case entity
122124
when Post
123125
Diaspora::Federation::Entities.post(entity)

spec/federation_callbacks_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@
364364
it "receives a entity" do
365365
received = Fabricate(:status_message_entity, author: remote_person.diaspora_handle)
366366
persisted = FactoryBot.create(:status_message)
367-
byebug
368367
expect(Diaspora::Federation::Receive).to receive(:perform).with(received).and_return(persisted)
369368
expect(Workers::ReceiveLocal).to receive(:perform_async).with(persisted.class.to_s, persisted.id, [])
370369

0 commit comments

Comments
 (0)