summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Ostler <scottbot9000@gmail.com>2011-01-13 01:38:19 -0500
committerScott Ostler <scottbot9000@gmail.com>2011-01-13 01:38:19 -0500
commit0d4ea04edc173f9f7ba90b850061ec0e4d41bc92 (patch)
tree4e5b1cadd4d9e09e024c896966fd65a7297fdfa8
parent6a0015db5563dc5fe7a54672581b8d59f0fd23e7 (diff)
parent482d439f6e8f024848a873772b0758645514a077 (diff)
Merge branch 'master' of ssh://dump.fm/pichat/repo
-rw-r--r--src/tags.clj31
-rw-r--r--template/mini_profile.st1
-rw-r--r--template/popular.st2
-rw-r--r--template/rooms/VIP.st6
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>