1 # this class pulls together the logic for all the old_* controllers
2 # into one place. as it turns out, the API methods for historical
3 # nodes, ways and relations are basically identical.
5 class OldElementsController < ApiController
6 before_action :setup_user_auth
10 before_action :lookup_old_element, :except => [:index]
11 before_action :lookup_old_element_versions, :only => [:index]
13 before_action :set_request_formats
16 # the .where() method used in the lookup_old_element_versions
17 # call won't throw an error if no records are found, so we have
18 # to do that ourselves.
19 raise OSM::APINotFoundError if @elements.empty?
21 # determine visible elements
22 @elems = if show_redactions?
29 respond_to do |format|
36 if @old_element.redacted? && !show_redactions?
40 response.last_modified = @old_element.timestamp
43 respond_to do |format|
53 current_user&.moderator? && params[:show_redactions] == "true"