1 class BrowseController < ApplicationController
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 before_action :update_totp, :only => [:query]
9 before_action :require_moderator_for_unredacted_history, :only => [:relation_history, :way_history, :node_history]
10 around_action :web_timeout
11 authorize_resource :class => false
15 @feature = Relation.preload(:relation_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :relation_members => :member).find(params[:id])
17 rescue ActiveRecord::RecordNotFound
18 render :action => "not_found", :status => :not_found
23 @feature = Relation.preload(:relation_tags, :old_relations => [:old_tags, { :changeset => [:changeset_tags, :user], :old_members => :member }]).find(params[:id])
25 rescue ActiveRecord::RecordNotFound
26 render :action => "not_found", :status => :not_found
31 @feature = Way.preload(:way_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :nodes => [:node_tags, { :ways => :way_tags }]).find(params[:id])
33 rescue ActiveRecord::RecordNotFound
34 render :action => "not_found", :status => :not_found
39 @feature = Way.preload(:way_tags, :old_ways => [:old_tags, { :changeset => [:changeset_tags, :user], :old_nodes => { :node => [:node_tags, :ways] } }]).find(params[:id])
41 rescue ActiveRecord::RecordNotFound
42 render :action => "not_found", :status => :not_found
47 @feature = Node.preload(:node_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :ways => :way_tags).find(params[:id])
49 rescue ActiveRecord::RecordNotFound
50 render :action => "not_found", :status => :not_found
55 @feature = Node.preload(:node_tags, :old_nodes => [:old_tags, { :changeset => [:changeset_tags, :user] }]).find(params[:id])
57 rescue ActiveRecord::RecordNotFound
58 render :action => "not_found", :status => :not_found
65 def require_moderator_for_unredacted_history
66 deny_access(nil) if params[:show_redactions] && !current_user&.moderator?