aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2010-11-15 17:39:33 +1300
committerPhilip Arndt <parndt@gmail.com>2010-11-15 17:39:52 +1300
commit5b55dc2f375cac1a78bc70150a9473a74271ffdd (patch)
tree6e8c3320ec2cbe40644390c79a776738eb572542 /app/models
parent426c0d913f62de7377d5b7dd3172f2e7117cfaec (diff)
downloadrefinerycms-blog-5b55dc2f375cac1a78bc70150a9473a74271ffdd.tar.gz
refinerycms-blog-5b55dc2f375cac1a78bc70150a9473a74271ffdd.tar.bz2
refinerycms-blog-5b55dc2f375cac1a78bc70150a9473a74271ffdd.zip
Added comment notifications.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/blog/comment_mailer.rb1
-rw-r--r--app/models/blog_comment.rb38
2 files changed, 25 insertions, 14 deletions
diff --git a/app/models/blog/comment_mailer.rb b/app/models/blog/comment_mailer.rb
new file mode 100644
index 0000000..dac526d
--- /dev/null
+++ b/app/models/blog/comment_mailer.rb
@@ -0,0 +1 @@
+require File.expand_path('../../../mailers/blog/comment_mailer', __FILE__) \ No newline at end of file
diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb
index 201f75c..b888e35 100644
--- a/app/models/blog_comment.rb
+++ b/app/models/blog_comment.rb
@@ -46,7 +46,7 @@ class BlogComment < ActiveRecord::Base
before_create do |comment|
unless BlogComment::Moderation.enabled?
- comment.state = comment.spam? ? 'rejected' : 'approved'
+ comment.state = comment.ham? ? 'approved' : 'rejected'
end
end
@@ -55,8 +55,7 @@ class BlogComment < ActiveRecord::Base
def enabled?
RefinerySetting.find_or_set(:comment_moderation, true, {
:scoping => :blog,
- :restricted => false,
- :callback_proc_as_string => nil
+ :restricted => false
})
end
@@ -64,8 +63,7 @@ class BlogComment < ActiveRecord::Base
RefinerySetting[:comment_moderation] = {
:value => !self.enabled?,
:scoping => :blog,
- :restricted => false,
- :callback_proc_as_string => nil
+ :restricted => false
}
end
end
@@ -74,21 +72,33 @@ class BlogComment < ActiveRecord::Base
module Notification
class << self
def recipients
- RefinerySetting.find_or_set(:comment_notification_recipients,
- (Role[:refinery].users.first.email rescue ''),
- {
- :scoping => :blog,
- :restricted => false,
- :callback_proc_as_string => nil
- })
+ RefinerySetting.find_or_set(:comment_notification_recipients, (Role[:refinery].users.first.email rescue ''),
+ {
+ :scoping => :blog,
+ :restricted => false
+ })
end
def recipients=(emails)
RefinerySetting[:comment_notification_recipients] = {
:value => emails,
:scoping => :blog,
- :restricted => false,
- :callback_proc_as_string => nil
+ :restricted => false
+ }
+ end
+
+ def subject
+ RefinerySetting.find_or_set(:comment_notification_subject, "New inquiry from your website", {
+ :scoping => :blog,
+ :restricted => false
+ })
+ end
+
+ def subject=(subject_line)
+ RefinerySetting[:comment_notification_subject] = {
+ :value => subject_line,
+ :scoping => :blog,
+ :restricted => false
}
end
end