X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/ddba8eeff7c828840c128ed70e414c55983a8404..33e3d3d5765ea1f84e1c46cd338c7bab1a1b2ed8:/app/controllers/trace_controller.rb diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index cabbb4ff9..47bc62be8 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -57,7 +57,12 @@ class TraceController < ApplicationController @tag = params[:tag] files = Tracetag.find_all_by_tag(params[:tag]).collect { |tt| tt.gpx_id } - conditions[0] += " AND gpx_files.id IN (#{files.join(',')})" + + if files.length > 0 + conditions[0] += " AND gpx_files.id IN (#{files.join(',')})" + else + conditions[0] += " AND 0 = 1" + end end conditions[0] += " AND gpx_files.visible = ?" @@ -87,6 +92,13 @@ class TraceController < ApplicationController end def mine + # Load the preference of whether the user set the trace public the last time + @trace = Trace.new + if @user.preferences.find(:first, :conditions => {:k => "gps.trace.public", :v => "default"}).nil? + @trace.public = false + else + @trace.public = true + end list(@user, "mine") end