]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/traces/icons_controller.rb
Make a generic preferred color scheme method
[rails.git] / app / controllers / traces / icons_controller.rb
index a581796548422f10464c1737741d5441d04c1108..a62e6af8630cfa2a22aaa2bd014cee55dfacb520 100644 (file)
@@ -6,21 +6,12 @@ module Traces
     authorize_resource :trace
 
     def show
-      trace = Trace.find(params[:trace_id])
+      trace = Trace.visible.imported.find(params[:trace_id])
 
-      if trace.visible? && trace.inserted?
-        if trace.public? || (current_user && current_user == trace.user)
-          if trace.icon.attached?
-            redirect_to rails_blob_path(trace.icon, :disposition => "inline")
-          else
-            expires_in 7.days, :private => !trace.public?, :public => trace.public?
-            send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => "image/gif", :disposition => "inline")
-          end
-        else
-          head :forbidden
-        end
+      if trace.public? || (current_user && current_user == trace.user)
+        redirect_to rails_blob_path(trace.icon, :disposition => "inline")
       else
-        head :not_found
+        head :forbidden
       end
     rescue ActiveRecord::RecordNotFound
       head :not_found