send private message

This commit is contained in:
Benjamin Neff 2016-05-25 02:57:01 +02:00
parent 5f25135848
commit b89c1d0cd7

View file

@ -3,7 +3,22 @@ module Diaspora
class Dispatcher
class Private < Dispatcher
def deliver_to_remote(people)
# TODO
entity = Entities.build(object)
Workers::SendPrivate.perform_async(sender.id, entity.to_s, targets(people, salmon_slap(entity)))
end
private
def targets(people, salmon_slap)
people.map {|person| [person.receive_url, salmon_slap.generate_xml(person.public_key)] }.to_h
end
def salmon_slap(entity)
DiasporaFederation::Salmon::EncryptedSlap.prepare(
sender.diaspora_handle,
sender.encryption_key,
entity
)
end
end
end