X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/03f733c4f4091dc53e391aa74a020681af98a4ff..001ff5764bcf15aaa179dc5c7844038676536622:/app/controllers/browse_controller.rb diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb index cb866eb3f..f6bd89d4d 100644 --- a/app/controllers/browse_controller.rb +++ b/app/controllers/browse_controller.rb @@ -4,7 +4,7 @@ class BrowseController < ApplicationController before_filter :authorize_web before_filter :set_locale before_filter { |c| c.check_database_readable(true) } - around_filter :timeout, :except => [:start] + around_filter :web_timeout, :except => [:start] def start end @@ -72,8 +72,10 @@ class BrowseController < ApplicationController @next = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id", { :id => @changeset.id }] ) @prev = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id", { :id => @changeset.id }] ) - @next_by_user = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] ) - @prev_by_user = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] ) + if @changeset.user.data_public? + @next_by_user = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id AND user_id = :user_id", { :id => @changeset.id, :user_id => @changeset.user_id }] ) + @prev_by_user = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id AND user_id = :user_id", { :id => @changeset.id, :user_id => @changeset.user_id }] ) + end rescue ActiveRecord::RecordNotFound render :action => "not_found", :status => :not_found end @@ -86,20 +88,4 @@ class BrowseController < ApplicationController rescue ActiveRecord::RecordNotFound render :action => "not_found", :status => :not_found end - -private - - def timeout - SystemTimer.timeout_after(30) do - yield - end - rescue ActionView::TemplateError => ex - if ex.original_exception.is_a?(Timeout::Error) - render :action => "timeout", :status => :request_timeout - else - raise - end - rescue Timeout::Error - render :action => "timeout", :status => :request_timeout - end end