]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_ways_controller.rb
Merge pull request #4550 from tomhughes/drop-user-tokens
[rails.git] / app / controllers / old_ways_controller.rb
1 class OldWaysController < ApplicationController
2   layout :map_layout
3
4   before_action :authorize_web
5   before_action :set_locale
6   before_action -> { check_database_readable(:need_api => true) }
7   before_action :require_oauth
8
9   authorize_resource
10
11   before_action :require_moderator_for_unredacted_history
12   around_action :web_timeout
13
14   def show
15     @type = "way"
16     @feature = OldWay.preload(:old_tags, :changeset => [:changeset_tags, :user], :old_nodes => { :node => [:node_tags, :ways] }).find([params[:id], params[:version]])
17   rescue ActiveRecord::RecordNotFound
18     render :action => "not_found", :status => :not_found
19   end
20
21   private
22
23   def require_moderator_for_unredacted_history
24     deny_access(nil) if params[:show_redactions] && !current_user&.moderator?
25   end
26 end