]> git.openstreetmap.org Git - rails.git/commitdiff
Don't show user navigation links for non-public users
authorTom Hughes <tom@compton.nu>
Tue, 23 Nov 2010 09:30:22 +0000 (09:30 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 23 Nov 2010 09:30:22 +0000 (09:30 +0000)
The changeset browser pages should not show the per-user navigation links
for changesets made by users that have not made their edits public.

app/controllers/browse_controller.rb

index 9aec1060a19b3c836e455c0abcc0dd36c79ec8cc..a7dd5f5c95ff8b745b19fc3cac1831ac38c2177a 100644 (file)
@@ -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 = 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
   rescue ActiveRecord::RecordNotFound
     render :action => "not_found", :status => :not_found
   end