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 around_action :web_timeout
10 authorize_resource :class => false
14 @feature = Relation.preload(:relation_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :relation_members => :member).find(params[:id])
16 rescue ActiveRecord::RecordNotFound
17 render :action => "not_found", :status => :not_found
22 @feature = Relation.preload(:relation_tags, :old_relations => [:old_tags, { :changeset => [:changeset_tags, :user], :old_members => :member }]).find(params[:id])
24 rescue ActiveRecord::RecordNotFound
25 render :action => "not_found", :status => :not_found
30 @feature = Way.preload(:way_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :nodes => [:node_tags, { :ways => :way_tags }]).find(params[:id])
32 rescue ActiveRecord::RecordNotFound
33 render :action => "not_found", :status => :not_found
38 @feature = Way.preload(:way_tags, :old_ways => [:old_tags, { :changeset => [:changeset_tags, :user], :old_nodes => { :node => [:node_tags, :ways] } }]).find(params[:id])
40 rescue ActiveRecord::RecordNotFound
41 render :action => "not_found", :status => :not_found
46 @feature = Node.preload(:node_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :ways => :way_tags).find(params[:id])
48 rescue ActiveRecord::RecordNotFound
49 render :action => "not_found", :status => :not_found
54 @feature = Node.preload(:node_tags, :old_nodes => [:old_tags, { :changeset => [:changeset_tags, :user] }]).find(params[:id])
56 rescue ActiveRecord::RecordNotFound
57 render :action => "not_found", :status => :not_found
62 @changeset = Changeset.find(params[:id])
63 @comments = if current_user&.moderator?
64 @changeset.comments.unscope(:where => :visible).includes(:author)
66 @changeset.comments.includes(:author)
68 @node_pages, @nodes = paginate(:old_nodes, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "node_page")
69 @way_pages, @ways = paginate(:old_ways, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "way_page")
70 @relation_pages, @relations = paginate(:old_relations, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "relation_page")
71 if @changeset.user.active? && @changeset.user.data_public?
72 @next_by_user = @changeset.user.changesets.where("id > ?", @changeset.id).reorder(:id => :asc).first
73 @prev_by_user = @changeset.user.changesets.where("id < ?", @changeset.id).reorder(:id => :desc).first
75 rescue ActiveRecord::RecordNotFound
76 render :action => "not_found", :status => :not_found