wco_models 3.1.0.191 → 3.1.0.193
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c53ddd403cc55954a1df11b9e56ced2f9e7c7c06d2bdd811d168fd67330ed4c
|
4
|
+
data.tar.gz: 6780da6d6ac23641ff9bfa637e10231df33a2e21898e0422cc4794d2f4a83777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fa3ad8806434774d813e9b6af35ea966665f9ad35b7613353df99c8b5ab4028cdafee1a4c5416ea6072387326615acfb8fe4ad00a8ecd11835fd024aeb10ac0
|
7
|
+
data.tar.gz: eb95c14521da85dc6c051af5934996de37e3fc0edbfe90ed97c03010439d35349ae58cdef11cbbdfd32f534464df154d68a80c831d5ed248aef418b34db9da24
|
@@ -37,6 +37,7 @@ class WcoEmail::EmailFilter
|
|
37
37
|
## 'and' - all conditions must match, for filter to match
|
38
38
|
has_many :skip_conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_skip_filter
|
39
39
|
accepts_nested_attributes_for :skip_conditions, allow_destroy: true
|
40
|
+
|
40
41
|
validate :validate_conditions
|
41
42
|
def validate_conditions
|
42
43
|
if conditions.length + skip_conditions.length == 0
|
@@ -42,6 +42,6 @@ class WcoEmail::EmailFilterAction
|
|
42
42
|
if [ KIND_AUTORESPOND ].include?( kind )
|
43
43
|
_value = WcoEmail::EmailTemplate.find( value )
|
44
44
|
end
|
45
|
-
"#{" " * indent }<
|
45
|
+
"#{" " * indent }<EFAction #{kind} `#{_value}` />\n"
|
46
46
|
end
|
47
47
|
end
|
@@ -18,15 +18,37 @@ class WcoEmail::EmailFilterCondition
|
|
18
18
|
field :value
|
19
19
|
validates :value, presence: true
|
20
20
|
|
21
|
+
def apply leadset:, message:
|
22
|
+
cond = self
|
23
|
+
reason = nil
|
24
|
+
case cond.field
|
25
|
+
when WcoEmail::FIELD_LEADSET
|
26
|
+
if cond.operator == WcoEmail::OPERATOR_NOT_HAS_TAG
|
27
|
+
this_tag = Wco::Tag.find cond.value
|
28
|
+
if leadset.tags.include?( this_tag )
|
29
|
+
;
|
30
|
+
else
|
31
|
+
reason = "{email_skip_filter ? 'skip_' : ''}condition leadset not-has-tag #{this_tag} NOT met"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
when WcoEmail::FIELD_TO
|
35
|
+
if message.to == cond.value
|
36
|
+
reason = "{email_skip_filter ? 'skip_' : ''}condition to = #{cond.value}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
return reason
|
40
|
+
end
|
41
|
+
|
42
|
+
|
21
43
|
def to_s
|
22
44
|
"<EFC #{field} #{operator} #{value} />"
|
23
45
|
end
|
24
46
|
def to_s_full indent: 0
|
25
47
|
_value = value
|
26
|
-
if [ OPERATOR_HAS_TAG, OPERATOR_NOT_HAS_TAG ].include?( operator )
|
48
|
+
if [ ::WcoEmail::OPERATOR_HAS_TAG, ::WcoEmail::OPERATOR_NOT_HAS_TAG ].include?( operator )
|
27
49
|
_value = Wco::Tag.find( value )
|
28
50
|
end
|
29
|
-
"#{" " * indent }<
|
51
|
+
"#{" " * indent }<EF#{email_skip_filter ? 'Skip' : ''}Condition #{field} #{operator} `#{_value}` />\n"
|
30
52
|
end
|
31
53
|
end
|
32
54
|
|
@@ -199,22 +199,8 @@ class WcoEmail::MessageStub
|
|
199
199
|
reason = 'subject_exact'
|
200
200
|
end
|
201
201
|
|
202
|
-
filter.conditions.each do |
|
203
|
-
|
204
|
-
when WcoEmail::FIELD_LEADSET
|
205
|
-
if cond.operator == WcoEmail::OPERATOR_NOT_HAS_TAG
|
206
|
-
this_tag = Wco::Tag.find cond.value
|
207
|
-
if leadset.tags.include?( this_tag )
|
208
|
-
;
|
209
|
-
else
|
210
|
-
reason = "condition leadset not-has-tag #{this_tag} NOT met"
|
211
|
-
end
|
212
|
-
end
|
213
|
-
when WcoEmail::FIELD_TO
|
214
|
-
if @message.to == cond.value
|
215
|
-
reason = "condition to = #{cond.value}"
|
216
|
-
end
|
217
|
-
end
|
202
|
+
filter.conditions.each do |scond|
|
203
|
+
reason ||= scond.apply(leadset: leadset, message: @message )
|
218
204
|
end
|
219
205
|
|
220
206
|
if reason
|
@@ -229,6 +215,10 @@ class WcoEmail::MessageStub
|
|
229
215
|
skip_reason = 'skip_from_regex'
|
230
216
|
end
|
231
217
|
|
218
|
+
filter.skip_conditions.each do |scond|
|
219
|
+
skip_reason ||= scond.apply(leadset: leadset, message: @message )
|
220
|
+
end
|
221
|
+
|
232
222
|
if skip_reason
|
233
223
|
puts! "NOT Applying filter #{filter} to conv #{@message.conversation} for matching #{skip_reason}" if DEBUG
|
234
224
|
else
|
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.
|
4
|
+
version: 3.1.0.193
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ahoy_matey
|