diff options
| -rw-r--r-- | src/tags.clj | 31 | ||||
| -rw-r--r-- | template/mini_profile.st | 1 | ||||
| -rw-r--r-- | template/popular.st | 2 | ||||
| -rw-r--r-- | template/rooms/VIP.st | 6 |
4 files changed, 21 insertions, 19 deletions
diff --git a/src/tags.clj b/src/tags.clj index 53236c5..fb530ea 100644 --- a/src/tags.clj +++ b/src/tags.clj @@ -332,21 +332,22 @@ WHERE EXISTS (defn fetch-dumps-by-ids ([ids] (fetch-dumps-by-ids ids nil)) ([ids viewer-nick] - (let [ids (map maybe-parse-int ids) - query (fetch-dumps-by-message-id-query :num-messages (count ids)) - raw-rows (do-select (vec (concat [query] ids))) - tagged-rows (map parse-tags-from-row-as-tag-map raw-rows) - index-func (fn [row] - (index-of #(= (:message_id row) %) ids))] - (for [m (sort-by index-func tagged-rows)] - (let [favers (get (:tags m) "favorite") - favorited (and viewer-nick - (boolean (some #(= % viewer-nick) favers))) - filtered-favers (filter #(not= % (:nick m)) favers)] - (assoc m - :favers filtered-favers - :favorited favorited - :count (count filtered-favers))))))) + (if-not (empty? ids) + (let [ids (map maybe-parse-int ids) + query (fetch-dumps-by-message-id-query :num-messages (count ids)) + raw-rows (do-select (vec (concat [query] ids))) + tagged-rows (map parse-tags-from-row-as-tag-map raw-rows) + index-func (fn [row] + (index-of #(= (:message_id row) %) ids))] + (for [m (sort-by index-func tagged-rows)] + (let [favers (get (:tags m) "favorite") + favorited (and viewer-nick + (boolean (some #(= % viewer-nick) favers))) + filtered-favers (filter #(not= % (:nick m)) favers)] + (assoc m + :favers filtered-favers + :favorited favorited + :count (count filtered-favers)))))))) (defn fetch-dump-by-id ([m-id] diff --git a/template/mini_profile.st b/template/mini_profile.st index a991f6b..90b1689 100644 --- a/template/mini_profile.st +++ b/template/mini_profile.st @@ -20,6 +20,7 @@ <div><a href="http://dump.fm/$nick$/log">dumps</a></div> <div><a href="http://dump.fm/$nick$/favorites">dumps faved</a></div> + <div><a href="http://dump.fm/$nick$/popular">top dumps</a></div> <br> <h3>contact info</h3> $if(contact)$ diff --git a/template/popular.st b/template/popular.st index c900dd9..162c63b 100644 --- a/template/popular.st +++ b/template/popular.st @@ -4,7 +4,7 @@ $head()$ <script> jQuery(function() { - initLog([]) + initLog($recips$); }); </script> diff --git a/template/rooms/VIP.st b/template/rooms/VIP.st index fa38eb5..9ade34c 100644 --- a/template/rooms/VIP.st +++ b/template/rooms/VIP.st @@ -10,7 +10,7 @@ \ \:\/:/ \ \:\ /:/ \ \:\ \ \::/ \ \::/ \ \:\ \ \::/ \ \:\/:/ \ \:\ \ \:\ \ \:\ \ \:\ \__\/ \ \::/ \ \:\ \ \:\ \ \:\ \ \:\ - \__\/ \__\/ \__\/ \__\/ \__\/ + \__\/ \__\/ \__\/ \__\/ \__\/ (c)2010 dump.fm --> @@ -140,8 +140,8 @@ <div id="vipinfo" style="position: absolute; z-index: 100000; right: 50; bottom: 125; background: white; padding: 10px; opacity: .75;"> <h1>Welcome to the cool club</h1> <ul> - <li><a href="/roomlist">Rooms</a></li> - <li><a href="/mutes">Mutes</a></li> + <li><a href="http://dump.fm/roomlist">Rooms</a></li> + <li><a href="http://dump.fm/mutes">Mutes</a></li> </ul> </div> </body> |
