1 class BrowseController < ApplicationController
4 before_action :authorize_web
5 before_action :set_locale
6 before_action -> { check_database_readable(true) }
7 before_action :require_oauth
8 around_action :web_timeout
9 authorize_resource :class => false
13 @feature = Relation.preload(:relation_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :relation_members => :member).find(params[:id])
15 rescue ActiveRecord::RecordNotFound
16 render :action => "not_found", :status => :not_found
21 @feature = Relation.preload(:relation_tags, :old_relations => [:old_tags, :changeset => [:changeset_tags, :user], :old_members => :member]).find(params[:id])
23 rescue ActiveRecord::RecordNotFound
24 render :action => "not_found", :status => :not_found
29 @feature = Way.preload(:way_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :nodes => [:node_tags, :ways => :way_tags]).find(params[:id])
31 rescue ActiveRecord::RecordNotFound
32 render :action => "not_found", :status => :not_found
37 @feature = Way.preload(:way_tags, :old_ways => [:old_tags, :changeset => [:changeset_tags, :user], :old_nodes => { :node => [:node_tags, :ways] }]).find(params[:id])
39 rescue ActiveRecord::RecordNotFound
40 render :action => "not_found", :status => :not_found
45 @feature = Node.preload(:node_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :ways => :way_tags).find(params[:id])
47 rescue ActiveRecord::RecordNotFound
48 render :action => "not_found", :status => :not_found
53 @feature = Node.preload(:node_tags, :old_nodes => [:old_tags, :changeset => [:changeset_tags, :user]]).find(params[:id])
55 rescue ActiveRecord::RecordNotFound
56 render :action => "not_found", :status => :not_found
61 @changeset = Changeset.find(params[:id])
62 @comments = if current_user&.moderator?
63 @changeset.comments.unscope(:where => :visible).includes(:author)
65 @changeset.comments.includes(:author)
67 @node_pages, @nodes = paginate(:old_nodes, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "node_page")
68 @way_pages, @ways = paginate(:old_ways, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "way_page")
69 @relation_pages, @relations = paginate(:old_relations, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "relation_page")
70 if @changeset.user.active? && @changeset.user.data_public?
71 @next_by_user = @changeset.user.changesets.where("id > ?", @changeset.id).reorder(:id => :asc).first
72 @prev_by_user = @changeset.user.changesets.where("id < ?", @changeset.id).reorder(:id => :desc).first
74 rescue ActiveRecord::RecordNotFound
75 render :action => "not_found", :status => :not_found
81 if current_user&.moderator?
82 @note = Note.find(params[:id])
83 @note_comments = @note.comments.unscope(:where => :visible)
85 @note = Note.visible.find(params[:id])
86 @note_comments = @note.comments
88 rescue ActiveRecord::RecordNotFound
89 render :action => "not_found", :status => :not_found