Sha256: af28734288fc8086708e6aa0d69916a68f9885fdaa2fbf6726c8010e4c101d6e

Contents?: true

Size: 1.25 KB

Versions: 30

Compression:

Stored size: 1.25 KB

Contents

##
## 2023-03-04 _vp_ When I receive one.
##
class WcoEmail::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_DESTROY_SCHS     = 'destroy-schs'

  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, KIND_DESTROY_SCHS]
  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

30 entries across 30 versions & 2 rubygems

Version Path
wco_models-3.1.0.37 app/models/wco_email/email_filter.rb
wco_models-3.1.0.36 app/models/wco_email/email_filter.rb
wco_models-3.1.0.35 app/models/wco_email/email_filter.rb
wco_models-3.1.0.34 app/models/wco_email/email_filter.rb
wco_models-3.1.0.33 app/models/wco_email/email_filter.rb
wco_models-3.1.0.32 app/models/wco_email/email_filter.rb
wco_models-3.1.0.31 app/models/wco_email/email_filter.rb
ish_models-3.1.0.29 app/models/wco_email/email_filter.rb
ish_models-3.1.0.28 app/models/wco_email/email_filter.rb
ish_models-3.1.0.27 app/models/wco_email/email_filter.rb
ish_models-3.1.0.26 app/models/wco_email/email_filter.rb
ish_models-3.1.0.25 app/models/wco_email/email_filter.rb
ish_models-3.1.0.24 app/models/wco_email/email_filter.rb
ish_models-3.1.0.23 app/models/wco_email/email_filter.rb
ish_models-3.1.0.22 app/models/wco_email/email_filter.rb
ish_models-3.1.0.21 app/models/wco_email/email_filter.rb
ish_models-3.1.0.20 app/models/wco_email/email_filter.rb
ish_models-3.1.0.19 app/models/wco_email/email_filter.rb
ish_models-3.1.0.18 app/models/wco_email/email_filter.rb
ish_models-3.1.0.17 app/models/wco_email/email_filter.rb