Add condition for user not found in trace controller.
authorThomas Wood <grand.edgemaster@gmail.com>
Sun, 19 Apr 2009 21:22:34 +0000 (21:22 +0000)
committerThomas Wood <grand.edgemaster@gmail.com>
Sun, 19 Apr 2009 21:22:34 +0000 (21:22 +0000)
Closes #1710

app/controllers/trace_controller.rb
app/views/trace/no_such_user.rhtml [new file with mode: 0644]

index 0603567c45a2310291374aa3b7cb4cb460014281..dc7456c45099ec923731ccd43944be57001bd459 100644 (file)
@@ -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 (file)
index 0000000..7820b48
--- /dev/null
@@ -0,0 +1,2 @@
+<h2><%= h(@not_found_user) %></h2>
+<p>Sorry, there is no user with the name <%= @not_found_user -%>. Please check your spelling, or maybe the link you clicked is wrong.</p>