Sha256: 5dceb57a1628a97d15b7a74f2874a18ac4ef412e140998410df0aa59d75328e8

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

##
## 2023-03-04 _vp_ When I receive one.
##
class Office::EmailFilter
  include Mongoid::Document
  include Mongoid::Timestamps

  field :from_regex
  field :from_exact
  field :subject_regex
  field :subject_exact
  field :body_regex
  field :body_exact


  KIND_AUTORESPOND_TMPL = 'autorespond-template'
  KIND_AUTORESPOND_EACT = 'autorespond-email-action'
  KIND_REMOVE_TAG       = 'remove-tag'
  KIND_ADD_TAG          = 'add-tag'

  KIND_AUTORESPOND = 'autorespond' # @deprecated, DO NOT USE!
  KIND_DELETE      = 'delete'      # @deprecated, use add-tag
  KIND_SKIP_INBOX  = 'skip-inbox'  # @deprecated, use remove-tag

  KINDS = [ nil, KIND_AUTORESPOND_TMPL, KIND_AUTORESPOND_EACT, KIND_ADD_TAG, KIND_REMOVE_TAG]
  field :kind

  STATE_ACTIVE   = 'active'
  STATE_INACTIVE = 'inactive'
  STATES = [ STATE_ACTIVE, STATE_INACTIVE ]
  field :state, type: :string, default: STATE_ACTIVE
  scope :active, ->{ where( state: STATE_ACTIVE ) }

  belongs_to :email_template, class_name: 'Ish::EmailTemplate', optional: true
  belongs_to :email_action,   class_name: 'Office::EmailAction', optional: true

  field :wp_term_id, type: :integer
  def category
    self.wp_term_id && WpTag.find( self.wp_term_id )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ish_models-0.0.33.251 lib/office/email_filter.rb
ish_models-0.0.33.250 lib/office/email_filter.rb
ish_models-0.0.33.249 lib/office/email_filter.rb