From: Tom Hughes Date: Tue, 23 Nov 2010 09:30:22 +0000 (+0000) Subject: Don't show user navigation links for non-public users X-Git-Tag: live~6802^2~42 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/7f955a4aca277350a70bb95f0ca97e64d7d808c4 Don't show user navigation links for non-public users The changeset browser pages should not show the per-user navigation links for changesets made by users that have not made their edits public. --- diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb index 9aec1060a..a7dd5f5c9 100644 --- a/app/controllers/browse_controller.rb +++ b/app/controllers/browse_controller.rb @@ -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