From: Thomas Wood Date: Sun, 19 Apr 2009 21:22:34 +0000 (+0000) Subject: Add condition for user not found in trace controller. X-Git-Tag: live~7601^2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/e8c7543bdd5001a69491b8119e793d6c889fe468?ds=sidebyside Add condition for user not found in trace controller. Closes #1710 --- diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 0603567c4..dc7456c45 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -16,6 +16,11 @@ class TraceController < ApplicationController display_name = params[:display_name] if target_user.nil? and !display_name.blank? target_user = User.find(:first, :conditions => [ "visible = ? and display_name = ?", true, display_name]) + if target_user.nil? + @not_found_user = display_name + render :action => 'no_such_user', :status => :not_found + return + end end # set title diff --git a/app/views/trace/no_such_user.rhtml b/app/views/trace/no_such_user.rhtml new file mode 100644 index 000000000..7820b4847 --- /dev/null +++ b/app/views/trace/no_such_user.rhtml @@ -0,0 +1,2 @@ +

<%= h(@not_found_user) %>

+

Sorry, there is no user with the name <%= @not_found_user -%>. Please check your spelling, or maybe the link you clicked is wrong.