From e8c7543bdd5001a69491b8119e793d6c889fe468 Mon Sep 17 00:00:00 2001 From: Thomas Wood Date: Sun, 19 Apr 2009 21:22:34 +0000 Subject: [PATCH] Add condition for user not found in trace controller. Closes #1710 --- app/controllers/trace_controller.rb | 5 +++++ app/views/trace/no_such_user.rhtml | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 app/views/trace/no_such_user.rhtml 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.

-- 2.43.2