]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/browse_controller.rb
Mass rename of "bugs" as "notes" for increased user friendliness
[rails.git] / app / controllers / browse_controller.rb
index d9b18769c37b934d8f77038c5884ee23418c9fe3..2036e4f10a83f547244b22d18e00590c44afe042 100644 (file)
@@ -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,34 +72,20 @@ 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
 
-  def bug
-    @type = "bug"
-    @bug = MapBug.find(params[:id])
-    @next = MapBug.find(:first, :order => "id ASC", :conditions => [ "status != 'hidden' AND id > :id", { :id => @bug.id }] )
-    @prev = MapBug.find(:first, :order => "id DESC", :conditions => [ "status != 'hidden' AND id < :id", { :id => @bug.id }] )
+  def note
+    @type = "note"
+    @note = Note.find(params[:id])
+    @next = Note.find(:first, :order => "id ASC", :conditions => [ "status != 'hidden' AND id > :id", { :id => @note.id }] )
+    @prev = Note.find(:first, :order => "id DESC", :conditions => [ "status != 'hidden' AND id < :id", { :id => @note.id }] )
   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"
-    else
-      raise
-    end
-  rescue Timeout::Error
-    render :action => "timeout"
-  end
 end