refactor controller when person is not found
This commit is contained in:
parent
da81c2e587
commit
03c94bc344
2 changed files with 12 additions and 8 deletions
|
|
@ -9,10 +9,12 @@ module DiasporaFederation
|
|||
def hcard
|
||||
person_hcard = DiasporaFederation.callbacks.trigger(:person_hcard_fetch, params[:guid])
|
||||
|
||||
return render nothing: true, status: 404 if person_hcard.nil?
|
||||
|
||||
logger.info "hcard profile request for: #{person_hcard.nickname}:#{person_hcard.guid}"
|
||||
render html: person_hcard.to_html.html_safe
|
||||
if person_hcard.nil?
|
||||
render nothing: true, status: 404 if person_hcard.nil?
|
||||
else
|
||||
logger.info "hcard profile request for: #{person_hcard.nickname}:#{person_hcard.guid}"
|
||||
render html: person_hcard.to_html.html_safe
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -37,10 +37,12 @@ module DiasporaFederation
|
|||
def legacy_webfinger
|
||||
person_wf = find_person_webfinger(params[:q]) if params[:q]
|
||||
|
||||
return render nothing: true, status: 404 if person_wf.nil?
|
||||
|
||||
logger.info "webfinger profile request for: #{person_wf.acct_uri}"
|
||||
render body: person_wf.to_xml, content_type: "application/xrd+xml"
|
||||
if person_wf.nil?
|
||||
render nothing: true, status: 404
|
||||
else
|
||||
logger.info "webfinger profile request for: #{person_wf.acct_uri}"
|
||||
render body: person_wf.to_xml, content_type: "application/xrd+xml"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
Loading…
Reference in a new issue