Permalink
Browse files

more tweakage

  • Loading branch information...
1 parent dfae80e commit 20feb5b277d85524d9182f7f81b44f9b824521a7 rsl committed Apr 15, 2008
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/lucky_sneaks/acts_as_snook.rb
@@ -65,19 +65,19 @@ def moderate(options = {})
# Returns true if marked as spam, false otherwise
def spam?
- calculate_snook_score unless snook_credits
+ calculate_snook_score unless already_calculated_snook
snook_spam_status == "spam"
end
# Returns true if marked as ham (safe to display), false if spam
def ham?
- calculate_snook_score unless snook_credits
+ calculate_snook_score unless already_calculated_snook
snook_spam_status == "ham"
end
# Returns true if marked as spam, false otherwise
def moderate?
- calculate_snook_score unless snook_credits
+ calculate_snook_score unless already_calculated_snook
snook_spam_status == "moderate"
end
@@ -86,6 +86,10 @@ def ham!
end
private
+ def already_calculated_snook
+ self.send(self.class.fields_for_snooking[:spam_status_field]) || snook_credits
+ end
+
def calculate_snook_for_body_links
link_count = snook_body.scan(/http:/).size
if link_count > 2

0 comments on commit 20feb5b

Please sign in to comment.