2 class IconsController < ApplicationController
3 before_action :authorize_web
4 before_action :check_database_readable
6 authorize_resource :trace
9 trace = Trace.visible.imported.find(params[:trace_id])
11 if trace.public? || (current_user && current_user == trace.user)
12 if trace.icon.attached?
13 redirect_to rails_blob_path(trace.icon, :disposition => "inline")
15 expires_in 7.days, :private => !trace.public?, :public => trace.public?
16 send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => "image/gif", :disposition => "inline")
21 rescue ActiveRecord::RecordNotFound