wco_models 3.1.0.192 → 3.1.0.194
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/README.txt +9 -0
- data/app/models/wco/office_action_template.rb +18 -0
- data/app/models/wco_email/email_filter.rb +1 -0
- data/app/models/wco_email/email_filter_action.rb +1 -1
- data/app/models/wco_email/email_filter_condition.rb +24 -2
- data/app/models/wco_email/message_stub.rb +6 -16
- data/app/views/wco/leadsets/_form.haml +4 -0
- data/app/views/wco/leadsets/index.haml +1 -3
- data/app/views/wco/leadsets/show.haml +4 -1
- data/app/views/wco/office_action_templates/_form.haml +2 -0
- data/lib/tasks/db_tasks.rake +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b3538da96d43d2b858d411c19ebc17ec895fc80775ab8fae866c6ba5eef66b4
|
4
|
+
data.tar.gz: f62962e74f94fa28d1252d72502470fd3b7dce833d875e2a86648138b613ec67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeed39e89ebbc919a75fa436a36a7b69c154839f17825aa72007766f728c99ae30cd9b22792c1b058d9745e3bbc6ec2f2ebece2cb69d2568bb841d5e8c2eee6d
|
7
|
+
data.tar.gz: cc252f6b9a5799cc4aa1835d4b74163ed981cd14c268f529dce89e321fb8466d28d39864e2fd57a804708c3549353a8f4bd42ba703f488f33362a6c90ef01139
|
data/README.txt
CHANGED
@@ -9,3 +9,12 @@ Login to the localstack container, then:
|
|
9
9
|
--key 00nn652jk1395ujdr3l11ib06jam0oevjqv2o4g1 \
|
10
10
|
--body /opt/tmp/00nn652jk1395ujdr3l11ib06jam0oevjqv2o4g1
|
11
11
|
|
12
|
+
In ruby console:
|
13
|
+
|
14
|
+
stub = WcoEmail::MessageStub.create({
|
15
|
+
object_key: '00nn652jk1395ujdr3l11ib06jam0oevjqv2o4g1',
|
16
|
+
bucket: 'wco-email-ses-development',
|
17
|
+
config: { process_images: false }.to_json,
|
18
|
+
})
|
19
|
+
stub.do_process
|
20
|
+
|
@@ -39,3 +39,21 @@ class Wco::OfficeActionTemplate
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
# OAT ||= Wco::OfficeActionTemplate
|
42
|
+
|
43
|
+
## mark-leadsets-as-spam
|
44
|
+
=begin
|
45
|
+
|
46
|
+
@conversations.each do |c|
|
47
|
+
c.tags.delete( Wco::Tag.inbox )
|
48
|
+
c.save
|
49
|
+
c.leadsets.each do |leadset|
|
50
|
+
leadset.tags.delete( Wco::Tag.not_spam )
|
51
|
+
leadset.tags.push( Wco::Tag.spam )
|
52
|
+
leadset.save
|
53
|
+
end
|
54
|
+
# print('.')
|
55
|
+
end
|
56
|
+
|
57
|
+
=end
|
58
|
+
|
59
|
+
|
@@ -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
|
data/lib/tasks/db_tasks.rake
CHANGED
@@ -8,6 +8,15 @@ namespace :db do
|
|
8
8
|
leadset.persisted?
|
9
9
|
lead = Wco::Lead.find_or_create_by({ email: 'poxlovi@gmail.com', leadset: leadset })
|
10
10
|
lead.persisted?
|
11
|
+
|
12
|
+
blank_email_template = WcoEmail::EmailTemplate.find_or_create_by({ slug: 'blank' })
|
13
|
+
blank_email_template.persisted?
|
14
|
+
|
15
|
+
Wco::Tag.inbox
|
16
|
+
Wco::Tag.trash
|
17
|
+
Wco::Tag.spam
|
18
|
+
Wco::Tag.not_spam
|
19
|
+
|
11
20
|
end
|
12
21
|
|
13
22
|
end
|
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.194
|
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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ahoy_matey
|