Module: BlogComment::Moderation

Defined in:
app/models/blog_comment.rb

Overview

Moderation module for comments

Class Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


84
85
86
87
88
89
90
91
# File 'app/models/blog_comment.rb', line 84

def enabled?
  value = Setting.find_by_name('comment_moderation').value
   if value.to_i == 1
     return true
   else
     return false
   end
end

.toggle!Object



93
94
95
96
97
98
99
100
101
102
103
104
# File 'app/models/blog_comment.rb', line 93

def toggle!
  new_value = {
    :value => !BlogComment::Moderation.enabled?,
    :scoping => 'blog',
    :restricted => false
  }
  if RefinerySetting.respond_to?(:set)
    RefinerySetting.set(:comment_moderation, new_value)
  else
    RefinerySetting[:comment_moderation] = new_value
  end
end