X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/f77ce935a44dfdef0dad5e10ff34eaeea5f11abc..9b1b6be3719edfe165d5ae1fce502bc6ffb5de24:/app/controllers/trace_controller.rb diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 9ed803bae..bcac11844 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -2,6 +2,7 @@ class TraceController < ApplicationController layout 'site' before_filter :authorize_web + before_filter :require_user, :only => [:mine, :edit, :delete, :make_public] before_filter :authorize, :only => [:api_details, :api_data, :api_create] before_filter :check_database_availability, :except => [:api_details, :api_data, :api_create] before_filter :check_read_availability, :only => [:api_details, :api_data, :api_create] @@ -47,8 +48,9 @@ class TraceController < ApplicationController if params[:tag] @tag = params[:tag] - conditions[0] += " AND EXISTS (SELECT * FROM gpx_file_tags AS gft WHERE gft.gpx_id = gpx_files.id AND gft.tag = ?)" - conditions << @tag + + files = Tracetag.find_all_by_tag(params[:tag]).collect { |tt| tt.gpx_id } + conditions[0] += " AND gpx_files.id IN (#{files.join(',')})" end conditions[0] += " AND gpx_files.visible = 1" @@ -77,11 +79,7 @@ class TraceController < ApplicationController end def mine - if @user - list(@user, "mine") unless @user.nil? - else - redirect_to :controller => 'user', :action => 'login', :referer => request.request_uri - end + list(@user, "mine") end def view