+ render :text => doc.to_s, :content_type => "text/xml"
+ end
+
+ def view
+ @this_user = User.find_by_display_name(params[:display_name], :conditions => {:visible => true})
+
+ if @this_user
+ @title = @this_user.display_name
+ else
+ @not_found_user = params[:display_name]
+ render :action => 'no_such_user', :status => :not_found
+ end
+ end
+
+ def make_friend
+ if params[:display_name]
+ name = params[:display_name]
+ new_friend = User.find_by_display_name(name, :conditions => {:visible => true})
+ friend = Friend.new
+ friend.user_id = @user.id
+ friend.friend_user_id = new_friend.id
+ unless @user.is_friends_with?(new_friend)
+ if friend.save
+ flash[:notice] = "#{name} is now your friend."
+ Notifier.deliver_friend_notification(friend)
+ else
+ friend.add_error("Sorry, failed to add #{name} as a friend.")
+ end
+ else
+ flash[:notice] = "You are already friends with #{name}."
+ end
+
+ redirect_to :controller => 'user', :action => 'view'
+ end