From e5b95a258abf453b52061fb3f0df0b8ae5625782 Mon Sep 17 00:00:00 2001 From: sostler Date: Sun, 24 Jan 2010 19:06:49 -0500 Subject: zero-length avatars aren't included in chat userlist --- src/site.clj | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/site.clj b/src/site.clj index b5c7ade..972da44 100755 --- a/src/site.clj +++ b/src/site.clj @@ -74,6 +74,9 @@ (defn resp-success [message] {:status 200 :headers {} :body (json-str message)}) +(defn non-empty-string? [s] + (and s (> (count s) 0))) + ;; Database (defn do-select [query] @@ -132,8 +135,7 @@ @(room :messages))))) (defn process-user [u] - (prn u) - (if (u :avatar) + (if (non-empty-string? (u :avatar)) {"nick" (u :nick) "avatar" (encode-html-entities (u :avatar))} {"nick" (u :nick)})) @@ -247,9 +249,6 @@ ;; Profile -(defn non-empty-string? [s] - (and s (> (count s) 0))) - (defn profile [session profile-nick offset] (let [user-info (fetch-nick profile-nick)] (if user-info -- cgit v1.2.3-70-g09d2