diff options
author | Azul <azul@leap.se> | 2013-01-23 09:39:50 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-01-23 09:39:50 +0100 |
commit | b530279a144ad5fb35070952898c8e6ae3ba68ea (patch) | |
tree | 221077738d4f6b6b646b535a0e5c559dd15f394b /users/lib/webfinger/user_presenter.rb | |
parent | def5a00415ebced58bb0f7c1254f6cbedb27a23f (diff) |
not inluding link to key if there is none
Diffstat (limited to 'users/lib/webfinger/user_presenter.rb')
-rw-r--r-- | users/lib/webfinger/user_presenter.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/users/lib/webfinger/user_presenter.rb b/users/lib/webfinger/user_presenter.rb index 8184c52..8288bff 100644 --- a/users/lib/webfinger/user_presenter.rb +++ b/users/lib/webfinger/user_presenter.rb @@ -12,16 +12,22 @@ class Webfinger::UserPresenter end def key - Base64.encode64(@subject.public_key.to_s) + if @subject.public_key.present? + Base64.encode64(@subject.public_key.to_s) + end + end + + def links + links = {} + links[:public_key] = { type: 'PGP', href: key } if key + return links end def to_json(options) { subject: "acct:#{email_identifier}", aliases: [ user_url(@subject, :host => @request.host) ], - links: { - public_key: { type: 'PGP', href: key } - } + links: links }.to_json(options) end |