]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/browse_controller.rb
Use with_locale for the copyright page
[rails.git] / app / controllers / browse_controller.rb
index 6eb9675683f81df3089136e9fdfca2ba62e9ae57..88871a9e127b03b17249f86ad8b8b16b851d1f5d 100644 (file)
@@ -3,9 +3,11 @@ class BrowseController < ApplicationController
 
   before_action :authorize_web
   before_action :set_locale
-  before_action(:except => [:query]) { |c| c.check_database_readable(true) }
+  before_action -> { check_database_readable(:need_api => true) }
   before_action :require_oauth
+  before_action :update_totp, :only => [:query]
   around_action :web_timeout
+  authorize_resource :class => false
 
   def relation
     @type = "relation"
@@ -17,7 +19,7 @@ class BrowseController < ApplicationController
 
   def relation_history
     @type = "relation"
-    @feature = Relation.preload(:relation_tags, :old_relations => [:old_tags, :changeset => [:changeset_tags, :user], :old_members => :member]).find(params[:id])
+    @feature = Relation.preload(:relation_tags, :old_relations => [:old_tags, { :changeset => [:changeset_tags, :user], :old_members => :member }]).find(params[:id])
     render "history"
   rescue ActiveRecord::RecordNotFound
     render :action => "not_found", :status => :not_found
@@ -25,7 +27,7 @@ class BrowseController < ApplicationController
 
   def way
     @type = "way"
-    @feature = Way.preload(:way_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :nodes => [:node_tags, :ways => :way_tags]).find(params[:id])
+    @feature = Way.preload(:way_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :nodes => [:node_tags, { :ways => :way_tags }]).find(params[:id])
     render "feature"
   rescue ActiveRecord::RecordNotFound
     render :action => "not_found", :status => :not_found
@@ -33,7 +35,7 @@ class BrowseController < ApplicationController
 
   def way_history
     @type = "way"
-    @feature = Way.preload(:way_tags, :old_ways => [:old_tags, :changeset => [:changeset_tags, :user], :old_nodes => { :node => [:node_tags, :ways] }]).find(params[:id])
+    @feature = Way.preload(:way_tags, :old_ways => [:old_tags, { :changeset => [:changeset_tags, :user], :old_nodes => { :node => [:node_tags, :ways] } }]).find(params[:id])
     render "history"
   rescue ActiveRecord::RecordNotFound
     render :action => "not_found", :status => :not_found
@@ -49,7 +51,7 @@ class BrowseController < ApplicationController
 
   def node_history
     @type = "node"
-    @feature = Node.preload(:node_tags, :old_nodes => [:old_tags, :changeset => [:changeset_tags, :user]]).find(params[:id])
+    @feature = Node.preload(:node_tags, :old_nodes => [:old_tags, { :changeset => [:changeset_tags, :user] }]).find(params[:id])
     render "history"
   rescue ActiveRecord::RecordNotFound
     render :action => "not_found", :status => :not_found
@@ -74,17 +76,5 @@ class BrowseController < ApplicationController
     render :action => "not_found", :status => :not_found
   end
 
-  def note
-    @type = "note"
-
-    if current_user&.moderator?
-      @note = Note.find(params[:id])
-      @note_comments = @note.comments.unscope(:where => :visible)
-    else
-      @note = Note.visible.find(params[:id])
-      @note_comments = @note.comments
-    end
-  rescue ActiveRecord::RecordNotFound
-    render :action => "not_found", :status => :not_found
-  end
+  def query; end
 end