Class: DiasporaFederation::FetchController

Inherits:
ApplicationController show all
Defined in:
app/controllers/diaspora_federation/fetch_controller.rb

Overview

This controller processes fetch requests.

Instance Method Summary collapse

Methods inherited from ApplicationController

#set_locale

Instance Method Details

#fetchObject

Returns the fetched entity or a redirect

GET /fetch/:type/:guid


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/diaspora_federation/fetch_controller.rb', line 9

def fetch
  entity = fetch_public_entity
  if entity
    magic_env = create_magic_envelope(entity)
    if magic_env
      render xml: magic_env, content_type: "application/magic-envelope+xml"
    else
      redirect_to DiasporaFederation.callbacks.trigger(:fetch_person_url_to,
                                                       entity.author, "/fetch/#{params[:type]}/#{params[:guid]}")
    end
  else
    head :not_found
  end
end