wco_models 3.1.0.149 → 3.1.0.150
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 +4 -4
- data/app/models/wco_email/email_filter.rb +3 -0
- data/app/models/wco_email/message_stub.rb +16 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4caf3551289f4e93e12b347077fe099d408423f006c898c6f0a52de21ba83b9
|
4
|
+
data.tar.gz: 6c791312ee20c155590aab0f4979df3f00494cc5b67e3569bdfae0d041547ff1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88fefaaff4c84e73dce70b323bd1700d44c0bf247f0fc302e81b26029a366dfa57a79cd349d0bcce2f46dc7f85457ad900939e61dd0859f48bc09aad8e3f97ce
|
7
|
+
data.tar.gz: 3cbd9b1eff2acc6511c74f383b6f35c8c4f30725ebe0fc79e0db3263ed532e92430975a63f71715a32a8ece1fbd81203684d85b8e7bde877a5277816a660d65f
|
@@ -17,6 +17,9 @@ class WcoEmail::EmailFilter
|
|
17
17
|
field :body_regex
|
18
18
|
field :body_exact
|
19
19
|
|
20
|
+
field :skip_from_regex
|
21
|
+
field :skip_to_exact
|
22
|
+
|
20
23
|
belongs_to :tag, class_name: 'Wco::Tag', inverse_of: :email_filters, optional: true
|
21
24
|
|
22
25
|
KIND_AUTORESPOND_TMPL = 'autorespond-template'
|
@@ -194,7 +194,22 @@ class WcoEmail::MessageStub
|
|
194
194
|
|
195
195
|
if reason
|
196
196
|
puts! "Applying filter #{filter} to conv #{@message.conversation} for matching #{reason}" if DEBUG
|
197
|
-
|
197
|
+
|
198
|
+
## skip
|
199
|
+
skip_reason = nil
|
200
|
+
if filter.skip_to_exact.present? && @message.to&.downcase.include?( filter.skip_to_exact.downcase )
|
201
|
+
skip_reason = 'skip_to_exact'
|
202
|
+
end
|
203
|
+
if filter.skip_from_regex.present? && @message.from.downcase.match( filter.skip_from_regex )
|
204
|
+
skip_reason = 'skip_from_regex'
|
205
|
+
end
|
206
|
+
|
207
|
+
if skip_reason
|
208
|
+
puts! "NOT Applying filter #{filter} to conv #{@message.conversation} for matching #{skip_reason}" if DEBUG
|
209
|
+
else
|
210
|
+
@message.apply_filter( filter )
|
211
|
+
end
|
212
|
+
|
198
213
|
end
|
199
214
|
end
|
200
215
|
|