X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/7058d836f75c845b7790c7ab6eb2f75844ce0c1c..2ed84e26cdeaaa20b8f607624d65b7891fcf1fed:/app/controllers/trace_controller.rb diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 6895a1bcf..06ae5dc3b 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -51,7 +51,8 @@ class TraceController < ApplicationController conditions << @tag end - conditions[0] += " AND gpx_files.visible = 1" #FIXME: use boolean true as parameter to active record + conditions[0] += " AND gpx_files.visible = ?" + conditions << true @trace_pages, @traces = paginate(:traces, :include => [:user, :tags], @@ -78,6 +79,12 @@ class TraceController < ApplicationController def mine if @user + @trace = Trace.new + unless @user.trace_public_default.nil? + @trace.public = true + else + @trace.public = false + end list(@user, "mine") unless @user.nil? else redirect_to :controller => 'user', :action => 'login', :referer => request.request_uri @@ -196,7 +203,7 @@ class TraceController < ApplicationController end def georss - conditions = ["gpx_files.public = 1"] + conditions = ["gpx_files.public = ?", true] if params[:display_name] conditions[0] += " AND users.display_name = ?" @@ -311,6 +318,17 @@ private else FileUtils.rm_f(filename) end + + # Finally save whether the user marked the trace as being public + if @trace.public? + if @user.trace_public_default.nil? + @user.preferences.create(:k => "gps.trace.public", :v => "default") + end + else + pref = @user.trace_public_default + pref.destroy unless pref.nil? + end + end end