]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_relations_controller.rb
Merge remote-tracking branch 'upstream/pull/5046'
[rails.git] / app / controllers / old_relations_controller.rb
1 class OldRelationsController < 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 index
15     @type = "relation"
16     @feature = Relation.preload(:relation_tags, :old_relations => [:old_tags, { :changeset => [:changeset_tags, :user], :old_members => :member }]).find(params[:id])
17     render "browse/history"
18   rescue ActiveRecord::RecordNotFound
19     render "browse/not_found", :status => :not_found
20   end
21
22   def show
23     @type = "relation"
24     @feature = OldRelation.preload(:old_tags, :changeset => [:changeset_tags, :user], :old_members => :member).find([params[:id], params[:version]])
25   rescue ActiveRecord::RecordNotFound
26     render :action => "not_found", :status => :not_found
27   end
28
29   private
30
31   def require_moderator_for_unredacted_history
32     deny_access(nil) if params[:show_redactions] && !current_user&.moderator?
33   end
34 end