aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/comment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/comment.rb')
-rw-r--r--app/models/comment.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb
index cc8d0e94b..59f91ffb7 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
# == Schema Information
#
# Table name: comments
@@ -20,6 +21,7 @@
# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class Comment < ActiveRecord::Base
+ include AdminColumn
strip_attributes!
belongs_to :user
@@ -31,6 +33,8 @@ class Comment < ActiveRecord::Base
validate :check_body_has_content,
:check_body_uses_mixed_capitals
+ scope :visible, where(:visible => true)
+
after_save :event_xapian_update
# When posting a new comment, use this to check user hasn't double
@@ -57,10 +61,6 @@ class Comment < ActiveRecord::Base
ret
end
- def raw_body
- read_attribute(:body)
- end
-
# So when takes changes it updates, or when made invisble it vanishes
def event_xapian_update
info_request_events.each { |event| event.xapian_mark_needs_index }
@@ -75,12 +75,6 @@ class Comment < ActiveRecord::Base
text.html_safe
end
- def for_admin_column
- self.class.content_columns.each do |column|
- yield(column.human_name, send(column.name), column.type.to_s, column.name)
- end
- end
-
private
def check_body_has_content