From 7f955a4aca277350a70bb95f0ca97e64d7d808c4 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 23 Nov 2010 09:30:22 +0000 Subject: [PATCH 1/1] 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. --- app/controllers/browse_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.39.5