wco_models 3.1.0.255 → 3.1.0.256
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df997a022614f9d91328ec9895d6751031d95757c3bd440a8d901e3b9ec05039
|
|
4
|
+
data.tar.gz: 0d5b4f8ae88b862dd789bd222d07f8a1d22830b2fc002fe443e9df3fe888fced
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eeb94f1ebc9fe0c9e8f889e91131fca6d3f497f641e2ab08edb2e762aeedc2716079a0e71ff33f5b3a00070161e8b13e015dc5a52a90fa3174dcf5c157271339
|
|
7
|
+
data.tar.gz: 6da49cff643a536dc13c169de9b37d0d82cf0ecfaf5cd1ef2bc3c1dc9cdca6c6a566e4d9b7de646698a94cc40124d73ef0a06c42f28c2a2f56e3d599493a806b
|
|
@@ -23,10 +23,12 @@ class Wco::OfficeAction
|
|
|
23
23
|
attr_accessor :deactivate
|
|
24
24
|
|
|
25
25
|
field :perform_at, type: :time
|
|
26
|
+
field :config, type: Hash, default: {}
|
|
26
27
|
|
|
27
28
|
def do_run
|
|
28
29
|
@oa = self
|
|
29
30
|
@oa.update!({ status: STATUS_INACTIVE })
|
|
31
|
+
@oat = @oa.office_action_template
|
|
30
32
|
|
|
31
33
|
begin
|
|
32
34
|
eval( @oa.tmpl.action_exe )
|
|
@@ -9,13 +9,14 @@ class WcoEmail::EmailFilterCondition
|
|
|
9
9
|
belongs_to :email_skip_filter, class_name: '::WcoEmail::EmailFilter', inverse_of: :skip_conditions, optional: true
|
|
10
10
|
|
|
11
11
|
FIELD_BODY = 'body'
|
|
12
|
+
FIELD_BODY_PLAIN = 'body-plain'
|
|
12
13
|
FIELD_FROM = 'from'
|
|
13
14
|
FIELD_TAGGED = 'leadset-tagged'
|
|
14
15
|
FIELD_NOT_TAGGED = 'leadset-not-tagged'
|
|
15
16
|
FIELD_SUBJECT = 'subject'
|
|
16
17
|
# FIELD_TO = 'to'
|
|
17
18
|
FIELD_TO_OR_CC = 'to-or-cc'
|
|
18
|
-
FIELD_OPTS = [ FIELD_SUBJECT, FIELD_FROM, FIELD_TO_OR_CC, FIELD_TAGGED, FIELD_NOT_TAGGED, FIELD_BODY ]
|
|
19
|
+
FIELD_OPTS = [ FIELD_SUBJECT, FIELD_FROM, FIELD_TO_OR_CC, FIELD_TAGGED, FIELD_NOT_TAGGED, FIELD_BODY, FIELD_BODY_PLAIN ]
|
|
19
20
|
field :field
|
|
20
21
|
validates :field, presence: true, inclusion: FIELD_OPTS
|
|
21
22
|
|
|
@@ -83,6 +83,29 @@ class WcoEmail::Message
|
|
|
83
83
|
has_many :photos, class_name: '::Wco::Photo'
|
|
84
84
|
has_many :replies, class_name: '::WcoEmail::Context', inverse_of: :reply_to_message
|
|
85
85
|
|
|
86
|
+
def apply2_filter filter
|
|
87
|
+
conv.filter = filter
|
|
88
|
+
filter.actions each do |action|
|
|
89
|
+
case action.kind
|
|
90
|
+
when WcoEmail::EmailFilterAction::KIND_OAT
|
|
91
|
+
|
|
92
|
+
config = {
|
|
93
|
+
'email_message_id' => self.id,
|
|
94
|
+
'lead_id' => lead_id,
|
|
95
|
+
'message_id' => self.id,
|
|
96
|
+
'stub_id' => stub_id,
|
|
97
|
+
}
|
|
98
|
+
oa = Wco::OfficeAction.create!({
|
|
99
|
+
office_action_template: filter.aject,
|
|
100
|
+
status: 'active',
|
|
101
|
+
perform_at: Time.now,
|
|
102
|
+
config: config,
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
86
109
|
def apply_filter filter
|
|
87
110
|
puts! filter, 'WcoEmail::Message#apply_filter' if DEBUG
|
|
88
111
|
conv.filter = filter
|
|
@@ -95,13 +95,9 @@ class WcoEmail::MessageStub
|
|
|
95
95
|
subject: subject,
|
|
96
96
|
date: json['date'].to_s,
|
|
97
97
|
|
|
98
|
-
from:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
tos: [ json['to'] ],
|
|
102
|
-
|
|
103
|
-
cc: json['cc'],
|
|
104
|
-
ccs: [ json['cc'] ],
|
|
98
|
+
from: from,
|
|
99
|
+
to: json['to'],
|
|
100
|
+
cc: json['cc'],
|
|
105
101
|
|
|
106
102
|
part_html: json['html_body'],
|
|
107
103
|
part_txt: json['plain_body'],
|
|
@@ -155,7 +151,7 @@ class WcoEmail::MessageStub
|
|
|
155
151
|
end
|
|
156
152
|
|
|
157
153
|
if reason
|
|
158
|
-
puts! "
|
|
154
|
+
puts! "Applying2 filter #{filter} to conv #{@message.conversation} for matching #{reason}" if DEBUG
|
|
159
155
|
|
|
160
156
|
## skip
|
|
161
157
|
skip_reason = nil
|
|
@@ -173,7 +169,7 @@ class WcoEmail::MessageStub
|
|
|
173
169
|
if skip_reason
|
|
174
170
|
puts! "NOT Applying filter #{filter} to conv #{@message.conversation} for matching #{skip_reason}" if DEBUG
|
|
175
171
|
else
|
|
176
|
-
@message.
|
|
172
|
+
@message.apply2_filter( filter )
|
|
177
173
|
end
|
|
178
174
|
end
|
|
179
175
|
end
|