From 97accf9489e1951fa1f2fa69e82e829d23f7d067 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 10 Aug 2010 14:37:22 +1200 Subject: Make comment moderation toggleable --- app/models/blog_comment.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/models') diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index ada3f14..aced256 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -6,4 +6,21 @@ class BlogComment < ActiveRecord::Base named_scope :approved, :conditions => {:approved => true} named_scope :rejected, :conditions => {:approved => false} + + module Moderation + class << self + def enabled? + RefinerySetting.find_or_set(:comment_moderation, { + :value => true, + :scoping => :blog + }) + end + + def toggle + currently = self.enabled? + RefinerySetting[:comment_moderation] = !currently + end + end + end + end -- cgit v1.2.3