]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/trace_controller.rb
Don't give an error when you access the login page when you are logged in. Instead...
[rails.git] / app / controllers / trace_controller.rb
index d94280a6af080c469a2662212382e340e05c4387..06ae5dc3b7e1910d6614295d9f5e791b0ec876dc 100644 (file)
@@ -79,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
@@ -312,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