Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: 4clojure/4clojure
base: 20d8b17455
head fork: 4clojure/4clojure
compare: e251d61620
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Nov 07, 2011
@arajek arajek Fixing a bug where a user would try to lookup a non-existing user's
profile and in return would get a empty profile.
Now the returned page is a 404 with an error message.
@dbyrne dbyrne Merge pull request #169 from arajek/develop
Fixing a bug when requesting a non-existing user's profile page
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/foreclojure/users.clj
9 src/foreclojure/users.clj
@@ -3,7 +3,7 @@
[clojure.string :as string]
[sandbar.stateful-session :as session]
[cheshire.core :as json])
- (:use [foreclojure.utils :only [from-mongo row-class rank-class get-user if-user with-user]]
+ (:use [foreclojure.utils :only [from-mongo row-class rank-class get-user if-user with-user flash-error ]]
[foreclojure.template :only [def-page content-page]]
[foreclojure.ring-utils :only [*http-scheme* static-url]]
[foreclojure.config :only [config repo-url]]
@@ -164,7 +164,7 @@
:heading-note [:span#all-users-link]
:sub-heading (list (format-user-ranking user-ranking)
[:span.contributor "*"] " "
- (link-to repo-url "4clojure contributor"))
+ (link-to repo-url "4clojure contributor") [:br])
:main (generate-user-list top-100 "user-table")})}))
;; TODO: this is snagged from problems.clj but can't be imported due to cyclic dependency, must refactor this out.
@@ -294,7 +294,10 @@
(defroutes users-routes
(GET "/users" [] (top-users-page))
(GET "/users/all" [] (all-users-page))
- (GET "/user/:username" [username] (user-profile username))
+ (GET "/user/:username" [username]
+ (if (nil? (get-user username))
+ {:status 404 :headers {"Content-Type" "text/plain"} :body "Error: This user does not exist, nice try though."}
+ (user-profile username)))
(POST "/user/follow/:username" [username] (static-follow-user username true))
(POST "/user/unfollow/:username" [username] (static-follow-user username false))
(POST "/rest/user/follow/:username" [username] (rest-follow-user username true))

No commit comments for this range

Something went wrong with that request. Please try again.