diaspora_federation/lib/diaspora_federation/federation/receiver/public.rb
Benjamin Neff 1dfe57ea7e
Add frozen_string_literal to all files
and remove redundant freezes
2019-10-21 03:11:12 +02:00

28 lines
655 B
Ruby

# frozen_string_literal: true
module DiasporaFederation
module Federation
module Receiver
# Receiver for public entities
class Public < AbstractReceiver
private
def validate
super
validate_public_flag
end
def validate_public_flag
return if !entity.respond_to?(:public) || entity.public
if entity.is_a?(Entities::Profile) &&
%i[bio birthday gender location].all? {|prop| entity.public_send(prop).nil? }
return
end
raise NotPublic, "received entity #{entity} should be public!"
end
end
end
end
end