wco_models 3.1.0.276 → 3.1.0.277

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d2d2fd07a9f97269d04402ecbe29c6e258f33d07a5e68c3cf4fc3e11066f146
4
- data.tar.gz: 445ab09e9ac094715bcedcc994f3d70f97b3afdf4460513e1471912e6b960de9
3
+ metadata.gz: 59bbe9fca27e45e1a8aa704924a3226370c80c50b9013933cda620acc207b50b
4
+ data.tar.gz: 0f5798419aa41a1614d26d5fba3e0ce77074a4feca39ae9e53daf248b30d4f6d
5
5
  SHA512:
6
- metadata.gz: b90e415933235fbc0a12e406da6ec7bc113b1e2119da06085812c50bcad796b956aca162ca518ec5592f3da90c62a85794d131f8331599760ee427b7bdb71c72
7
- data.tar.gz: d67a830c270ac218edffaee49100c7ac94da66db961bd3957bf60acae2b6990338f0ace9cb0e3889a35d34876834b586b37cac13e48e04d0db51382afb29b909
6
+ metadata.gz: 426d2ca9c3cc36180e59138bf367c1d214c1de63a107a985c20edefd284f62cf60e8b86ce9131234acd76e98c9222e62099bbd99a6f3fc0b8369c119356a340a
7
+ data.tar.gz: 62da91faab86cc630b7050ddebd2c1259f027b9405517acf1b0685793020feecab536951a01abaf0123967713576030de063bf43f55ef7bd69b43c73fa1d588f
@@ -5,22 +5,10 @@ class WcoEmail::EmailFilter
5
5
  include Mongoid::Paranoia
6
6
  store_in collection: 'office_email_filters' ## 'wco_email_email_filters'
7
7
 
8
- field :descr, type: :string
8
+ field :slug, type: :string
9
9
 
10
10
  PAGE_PARAM_NAME = :filters_page
11
11
 
12
- ## @deprecated, use email_filter_conditions
13
- field :from_regex
14
- field :from_exact
15
- field :subject_regex
16
- field :subject_exact
17
- field :body_regex
18
- field :body_exact
19
- field :tag_id_exact
20
-
21
- field :skip_from_regex
22
- field :skip_to_exact
23
-
24
12
  STATUS_ACTIVE = 'active'
25
13
  STATUS_INACTIVE = 'inactive'
26
14
  field :status, type: :string, default: STATUS_ACTIVE
@@ -35,58 +23,27 @@ class WcoEmail::EmailFilter
35
23
  end
36
24
  end
37
25
 
38
- ## 'and' - all conditions must match, for filter to match
39
26
  has_many :conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_filter
40
27
  accepts_nested_attributes_for :conditions, allow_destroy: true, reject_if: :all_blank
41
-
42
- ## 'and' - all conditions must match, for filter to match
43
- has_many :skip_conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_skip_filter
44
- accepts_nested_attributes_for :skip_conditions, allow_destroy: true, reject_if: :all_blank
45
-
46
- # validate :validate_conditions
28
+ validate :validate_conditions
47
29
  def validate_conditions
48
- if conditions.length + skip_conditions.length == 0
49
- errors.add(:conditions, 'Either conditions or skip conditions must be present.')
30
+ if conditions.length == 0
31
+ errors.add(:condition, 'must be present')
50
32
  end
51
33
  end
52
34
 
53
- has_and_belongs_to_many :leadsets, class_name: '::Wco::Leadset'
54
-
55
- ## @deprecated 2026-04-02
56
- KIND_AUTORESPOND_TMPL = 'autorespond-template'
57
- KIND_AUTORESPOND_EACT = 'autorespond-email-action'
58
- KIND_REMOVE_TAG = 'remove-tag'
59
- KIND_ADD_TAG = 'add-tag'
60
- KIND_DESTROY_SCHS = 'destroy-schs'
61
- KIND_OAT = 'office-action'
62
-
63
- ## @deprecated
64
- KIND_AUTORESPOND = 'autorespond' ## @deprecated, DO NOT USE!
65
- KIND_DELETE = 'delete' ## @deprecated, use add-tag
66
- KIND_SKIP_INBOX = 'skip-inbox' ## @deprecated, use remove-tag
67
-
68
- KINDS = [ nil, KIND_OAT, KIND_AUTORESPOND_TMPL, KIND_AUTORESPOND_EACT, KIND_ADD_TAG, KIND_REMOVE_TAG, KIND_DESTROY_SCHS ]
69
- field :kind ## @deprecated, use filter.action.aject.kind 2026-04-02
70
-
35
+ has_many :skip_conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_skip_filter
36
+ accepts_nested_attributes_for :skip_conditions, allow_destroy: true, reject_if: :all_blank
71
37
 
72
- belongs_to :email_template, class_name: '::WcoEmail::EmailTemplate', optional: true
73
- belongs_to :email_action_template, class_name: '::WcoEmail::EmailActionTemplate', optional: true
38
+ has_and_belongs_to_many :leadsets, class_name: '::Wco::Leadset'
39
+ has_and_belongs_to_many :conversations, class_name: '::WcoEmail::Conversation'
74
40
 
75
- ## no habtm please
76
- # has_and_belongs_to_many :action_tmpls, class_name: '::Wco::OfficeActionTemplate'
77
- belongs_to :office_action_template, class_name: '::Wco::OfficeActionTemplate', optional: true
78
41
  belongs_to :tag, class_name: '::Wco::Tag', optional: true, inverse_of: :email_filters
79
42
 
80
- has_and_belongs_to_many :conversations, class_name: '::WcoEmail::Conversation'
81
-
82
43
  def to_s
83
44
  "EmailFilter: #{from_regex} #{from_exact} #{conditions.map { |c| c.to_s }.join }"
84
45
  end
85
46
  def to_s_full
86
- # inn = ""
87
- # inn = "#{inn}#{conditions.map { |c| c.to_s_full }.join }" if conditions.present?
88
- # inn = "#{inn}#{skip_conditions.map { |c| c.to_s_full }.join }" if skip_conditions.present?
89
-
90
47
  attrs = ''
91
48
  if from_regex || from_exact
92
49
  attrs = "#{attrs} from=#{from_regex}#{from_exact}"
@@ -105,19 +62,60 @@ AOL
105
62
  out
106
63
  end
107
64
 
108
- def to_xml
109
- attrs = ''
110
- children = ''
111
- if from_regex || from_exact
112
- attrs = "#{attrs} from=#{from_regex}#{from_exact}"
113
- end
114
- if conditions.present?
115
- children = "#{children}#{conditions.map { |c| c.to_s }.join('') }"
116
- end
117
- return "<EF #{attrs}>#{children}</EF>\n"
118
- end
119
65
 
120
66
 
121
67
 
68
+
69
+
70
+ ##
71
+ ## deprecated
72
+ ##
73
+
74
+ ## @deprecated, use email_filter_conditions
75
+ field :from_regex
76
+ field :from_exact
77
+ field :subject_regex
78
+ field :subject_exact
79
+ field :body_regex
80
+ field :body_exact
81
+ field :tag_id_exact
82
+
83
+ field :skip_from_regex
84
+ field :skip_to_exact
85
+
86
+ ## @deprecated 2026-04-02, use email_filter_action::<KIND>
87
+ KIND_AUTORESPOND_TMPL = 'autorespond-template'
88
+ KIND_AUTORESPOND_EACT = 'autorespond-email-action'
89
+ KIND_REMOVE_TAG = 'remove-tag'
90
+ KIND_ADD_TAG = 'add-tag'
91
+ KIND_DESTROY_SCHS = 'destroy-schs'
92
+ KIND_OAT = 'office-action'
93
+
94
+ ## @deprecated
95
+ KIND_AUTORESPOND = 'autorespond' ## @deprecated, DO NOT USE!
96
+ KIND_DELETE = 'delete' ## @deprecated, use add-tag
97
+ KIND_SKIP_INBOX = 'skip-inbox' ## @deprecated, use remove-tag
98
+
99
+ KINDS = [ nil, KIND_OAT, KIND_AUTORESPOND_TMPL, KIND_AUTORESPOND_EACT, KIND_ADD_TAG, KIND_REMOVE_TAG, KIND_DESTROY_SCHS ]
100
+ field :kind ## @deprecated, use filter.action.aject.kind 2026-04-02
101
+
102
+ ## @deprecated, use email_filter.email_action.aject
103
+ belongs_to :email_template, class_name: '::WcoEmail::EmailTemplate', optional: true
104
+ belongs_to :email_action_template, class_name: '::WcoEmail::EmailActionTemplate', optional: true
105
+ belongs_to :office_action_template, class_name: '::Wco::OfficeActionTemplate', optional: true
106
+
107
+ ## use to_s_full
108
+ # def to_xml
109
+ # attrs = ''
110
+ # children = ''
111
+ # if from_regex || from_exact
112
+ # attrs = "#{attrs} from=#{from_regex}#{from_exact}"
113
+ # end
114
+ # if conditions.present?
115
+ # children = "#{children}#{conditions.map { |c| c.to_s }.join('') }"
116
+ # end
117
+ # return "<EF #{attrs}>#{children}</EF>\n"
118
+ # end
119
+
122
120
  end
123
121
  ::EF = WcoEmail::EmailFilter
@@ -118,7 +118,7 @@ class WcoEmail::Message
118
118
 
119
119
  def apply_filter filter
120
120
  puts! filter, 'WcoEmail::Message#apply_filter' if DEBUG
121
- conv.filter = filter
121
+ conv.filters << filter
122
122
 
123
123
  case filter.kind
124
124
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.276
4
+ version: 3.1.0.277
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-01 00:00:00.000000000 Z
11
+ date: 2026-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3