refactor controller when person is not found

This commit is contained in:
Benjamin Neff 2015-07-22 01:30:45 +02:00
parent da81c2e587
commit 03c94bc344
2 changed files with 12 additions and 8 deletions

View file

@ -9,10 +9,12 @@ module DiasporaFederation
def hcard def hcard
person_hcard = DiasporaFederation.callbacks.trigger(:person_hcard_fetch, params[:guid]) person_hcard = DiasporaFederation.callbacks.trigger(:person_hcard_fetch, params[:guid])
return render nothing: true, status: 404 if person_hcard.nil? if person_hcard.nil?
render nothing: true, status: 404 if person_hcard.nil?
logger.info "hcard profile request for: #{person_hcard.nickname}:#{person_hcard.guid}" else
render html: person_hcard.to_html.html_safe logger.info "hcard profile request for: #{person_hcard.nickname}:#{person_hcard.guid}"
render html: person_hcard.to_html.html_safe
end
end end
end end
end end

View file

@ -37,10 +37,12 @@ module DiasporaFederation
def legacy_webfinger def legacy_webfinger
person_wf = find_person_webfinger(params[:q]) if params[:q] person_wf = find_person_webfinger(params[:q]) if params[:q]
return render nothing: true, status: 404 if person_wf.nil? if person_wf.nil?
render nothing: true, status: 404
logger.info "webfinger profile request for: #{person_wf.acct_uri}" else
render body: person_wf.to_xml, content_type: "application/xrd+xml" logger.info "webfinger profile request for: #{person_wf.acct_uri}"
render body: person_wf.to_xml, content_type: "application/xrd+xml"
end
end end
private private