diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-10-07 19:03:00 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-10-07 19:03:00 +0200 |
commit | 96f17e7d17ff44671d11f73b8eb5adfafd81eef4 (patch) | |
tree | 3a991d57252b06671776533134c4a6ec962b812d | |
parent | b5c357c081a4901c892ab0e61e33ab94ade98086 (diff) |
Hide spam comments.
darcs-hash:857a0fd8096dff8f61c30ee9dce15abbddbe2387
-rw-r--r-- | journal-content.lisp | 24 | ||||
-rwxr-xr-x | journal.lisp | 3 |
2 files changed, 19 insertions, 8 deletions
diff --git a/journal-content.lisp b/journal-content.lisp index 92c5d6c..630599e 100644 --- a/journal-content.lisp +++ b/journal-content.lisp @@ -154,15 +154,25 @@ (defgeneric comments-about (thing &key ordered-p)) (defgeneric (setf comments-about) (new-value thing &key ordered-p)) -(defmethod comments-about ((journal-entry journal-entry) &key ordered-p) +(defmethod comments-about ((journal-entry journal-entry) &key ordered-p ham-p) #.(locally-enable-sql-reader-syntax) (prog1 (if ordered-p - (select 'journal-comment - :where [= [slot-value 'journal-comment 'entry-id] - (id-of journal-entry)] - :order-by '([date]) - :flatp t) - (%comments-about journal-entry)) + (if ham-p + (select 'journal-comment + :where [and [= [slot-value 'journal-comment 'entry-id] + (id-of journal-entry)] + [not [= [slot-value 'journal-comment 'spam-p] + "t"]]] + :order-by '([date]) + :flatp t) + (select 'journal-comment + :where [= [slot-value 'journal-comment 'entry-id] + (id-of journal-entry)] + :order-by '([date]) + :flatp t)) + (if ham-p + (remove-if #'spamp (%comments-about journal-entry)) + (%comments-about journal-entry))) #.(restore-sql-reader-syntax-state))) diff --git a/journal.lisp b/journal.lisp index 8e612e5..1d9aa43 100755 --- a/journal.lisp +++ b/journal.lisp @@ -126,7 +126,8 @@ (with-slots (id title body categories date) journal-entry (show-journal-entry-with-components id title body categories date (comments-about journal-entry - :ordered-p t) + :ordered-p t + :ham-p t) comments-p))) |