Sha256: 9e2e41d47d130cc53ccd40c40b0be7f582b5abccfd8fe1f7b043558a8ee00fed
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require_dependency 'spam_protection' require 'timeout' class Comment < Feedback belongs_to :user, optional: true content_fields :body validates :author, :body, presence: true after_save :send_notifications attr_accessor :referrer, :permalink scope :spam, -> { where(state: 'spam') } scope :not_spam, -> { where("state != 'spam'") } scope :presumed_spam, -> { where(state: 'presumed_spam') } scope :presumed_ham, -> { where(state: 'presumed_ham') } scope :ham, -> { where(state: 'ham') } scope :unconfirmed, -> { where(state: %w(presumed_spam presumed_ham)) } scope :last_published, -> { published.limit(5).order('created_at DESC') } def notify_user_via_email(user) EmailNotify.send_comment(self, user) if user.notify_via_email? end def interested_users User.where(notify_on_comments: true) end def default_text_filter TextFilter.find_or_default(blog.comment_text_filter) end def feed_title "Comment on #{article.title} by #{author}" end protected def article_allows_feedback? return true if article.allow_comments? errors.add(:article, 'Article is not open to comments') false end def originator author end def content_fields [:body] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
publify_core-9.0.0.pre6 | app/models/comment.rb |
publify_core-9.0.0.pre5 | app/models/comment.rb |