aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/comment.rb
diff options
context:
space:
mode:
authorfrancis <francis>2009-08-18 20:51:25 +0000
committerfrancis <francis>2009-08-18 20:51:25 +0000
commit32c1fe80dc3fefc85d27a8465b67084fbd4fe60e (patch)
tree919a1bfef9b8098a04af19cab111cdf10fe32bfb /app/models/comment.rb
parentb7e060461e986a5bedb4c018b44ae3f1f34d7f11 (diff)
Don't allow duplicate followup messages to the same request.
Prevent requests, followups and annotations which have all capitals or all lowercase letters.
Diffstat (limited to 'app/models/comment.rb')
-rw-r--r--app/models/comment.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 250b94c20..af6a4f9ef 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -19,7 +19,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: comment.rb,v 1.16 2009-06-26 14:28:37 francis Exp $
+# $Id: comment.rb,v 1.17 2009-08-18 20:51:26 francis Exp $
class Comment < ActiveRecord::Base
strip_attributes!
@@ -58,6 +58,9 @@ class Comment < ActiveRecord::Base
if self.body.empty? || self.body =~ /^\s+$/
errors.add(:body, "^Please enter your annotation")
end
+ if !MySociety::Validate.uses_mixed_capitals(self.body)
+ errors.add(:body, '^Please write your annotation using a mixture of capital and lower case letters. This makes it easier for others to read.')
+ end
end
# Return body for display as HTML