From ccd0ddba1df405b6560821903bfa820bf4c54d10 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Tue, 22 Feb 2011 01:21:00 -0500 Subject: add updating fav counts --- src/utils.clj | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/utils.clj b/src/utils.clj index 22a0b5d..a332898 100755 --- a/src/utils.clj +++ b/src/utils.clj @@ -376,14 +376,16 @@ (defn initialize-template [st session] (.setAttribute st "domain" config/*server-url*) - (if (session :nick) - (doto st - (.setAttribute "user_email" (session :email)) - (.setAttribute "user_nick" (session :nick)) - (.setAttribute "user_avatar" (if (non-empty-string? (session :avatar)) - (session :avatar) - nil)) - (.setAttribute "isadmin" (session :is_admin)))) + (doto st + ; user_nick is used in some templates to test if user is logged in, + ; and stringtemplate only recognizes variables set to false, not nil. + (.setAttribute "logged_in" (not (nil? (:nick session)))) + (.setAttribute "user_nick" (or (:nick session) false)) + (.setAttribute "user_email" (:email session)) + (.setAttribute "user_avatar" (if (non-empty-string? (:avatar session)) + (:avatar session) + nil)) + (.setAttribute "isadmin" (:is_admin session))) st) (defn fetch-template [template session] -- cgit v1.2.3-70-g09d2