Adds review-related methods to comment & debate

This commit is contained in:
kikito
2015-08-21 21:58:48 +02:00
parent b4bd70436a
commit 2c49d30952
2 changed files with 16 additions and 0 deletions

View File

@@ -46,6 +46,14 @@ class Comment < ActiveRecord::Base
hidden? || user.hidden?
end
def reviewed?
reviewed_at.present?
end
def mark_as_reviewed
update(reviewed_at: Time.now)
end
# TODO: faking counter cache since there is a bug with acts_as_nested_set :counter_cache
# Remove when https://github.com/collectiveidea/awesome_nested_set/issues/294 is fixed
# and reset counters using

View File

@@ -69,6 +69,14 @@ class Debate < ActiveRecord::Base
count < 0 ? 0 : count
end
def reviewed?
reviewed_at.present?
end
def mark_as_reviewed
update(reviewed_at: Time.now)
end
protected
def sanitize_description