ish_models 0.0.33.282 → 0.0.33.283
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/lib/ish/email_template.rb +1 -1
- data/lib/office/email_conversation.rb +0 -41
- data/lib/office/email_message.rb +41 -0
- 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: f08684b167a8a9dd2f48caf9441d0c328ce9fef962a3964feeb0fb067a74db6c
|
|
4
|
+
data.tar.gz: d006ee0f98934aa7b7146fbd434faa81e696a48e8f391381ed9dd78d4b70be7f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04a4903ee82b65803e0cadd5b2235935ce9041f6c442defd558c3d81e14a522a47d6510aaf69e32b71d0bd5c16a9f8590acd7fa7506417ab17789e34fd59f88a
|
|
7
|
+
data.tar.gz: 5bae3c73bc973fb0b240b9cfba54cc42e2de35c6257226dc386d130bc0f272a3a2bb770e0d42144f127a2bf3b782b0ce3b6cc9aa8032aa181e1438f0bbc5cf95
|
data/lib/ish/email_template.rb
CHANGED
|
@@ -26,7 +26,7 @@ class ::Ish::EmailTemplate
|
|
|
26
26
|
field :subject
|
|
27
27
|
field :body
|
|
28
28
|
field :can_unsubscribe, type: :boolean, default: true
|
|
29
|
-
field :config_exe, default: "" ##
|
|
29
|
+
field :config_exe, default: "" ## unused! _vp_ 2023-09-24
|
|
30
30
|
field :config_json, type: Object, default: '{}'
|
|
31
31
|
|
|
32
32
|
FROM_EMAILS = [
|
|
@@ -73,47 +73,6 @@ class Office::EmailConversation
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
def apply_filter filter
|
|
77
|
-
case filter.kind
|
|
78
|
-
|
|
79
|
-
when ::Office::EmailFilter::KIND_DESTROY_SCHS
|
|
80
|
-
add_tag ::WpTag::TRASH
|
|
81
|
-
remove_tag ::WpTag::INBOX
|
|
82
|
-
tmp_lead = ::Lead.where( email: self.part_txt.split("\n")[1] ).first
|
|
83
|
-
if tmp_lead
|
|
84
|
-
tmp_lead.schs.each do |sch|
|
|
85
|
-
sch.update_attributes({ state: ::Sch::STATE_TRASH })
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
when ::Office::EmailFilter::KIND_ADD_TAG
|
|
90
|
-
add_tag filter.wp_term_id
|
|
91
|
-
if ::WpTag::TRASH == ::WpTag.find( filter.wp_term_id ).slug
|
|
92
|
-
remove_tag ::WpTag::INBOX
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
when ::Office::EmailFilter::KIND_REMOVE_TAG
|
|
96
|
-
remove_tag filter.wp_term_id
|
|
97
|
-
|
|
98
|
-
when ::Office::EmailFilter::KIND_AUTORESPOND_TMPL
|
|
99
|
-
Ish::EmailContext.create({
|
|
100
|
-
email_template: filter.email_template,
|
|
101
|
-
lead_id: lead.id,
|
|
102
|
-
send_at: Time.now + 22.minutes,
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
when ::Office::EmailFilter::KIND_AUTORESPOND_EACT
|
|
106
|
-
::Sch.create({
|
|
107
|
-
email_action: filter.email_action,
|
|
108
|
-
state: ::Sch::STATE_ACTIVE,
|
|
109
|
-
lead_id: lead.id,
|
|
110
|
-
perform_at: Time.now + 22.minutes,
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
else
|
|
114
|
-
raise "unknown filter kind: #{filter.kind}"
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
76
|
|
|
118
77
|
|
|
119
78
|
|
data/lib/office/email_message.rb
CHANGED
|
@@ -58,6 +58,47 @@ class Office::EmailMessage
|
|
|
58
58
|
body
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
|
|
62
|
+
def apply_filter filter
|
|
63
|
+
case filter.kind
|
|
64
|
+
|
|
65
|
+
when ::Office::EmailFilter::KIND_DESTROY_SCHS
|
|
66
|
+
conv.add_tag ::WpTag::TRASH
|
|
67
|
+
conv.remove_tag ::WpTag::INBOX
|
|
68
|
+
lead.schs.each do |sch|
|
|
69
|
+
sch.update_attributes({ state: ::Sch::STATE_TRASH })
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
when ::Office::EmailFilter::KIND_ADD_TAG
|
|
73
|
+
conv.add_tag filter.wp_term_id
|
|
74
|
+
if ::WpTag::TRASH == ::WpTag.find( filter.wp_term_id ).slug
|
|
75
|
+
conv.remove_tag ::WpTag::INBOX
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
when ::Office::EmailFilter::KIND_REMOVE_TAG
|
|
79
|
+
conv.remove_tag filter.wp_term_id
|
|
80
|
+
|
|
81
|
+
when ::Office::EmailFilter::KIND_AUTORESPOND_TMPL
|
|
82
|
+
Ish::EmailContext.create({
|
|
83
|
+
email_template: filter.email_template,
|
|
84
|
+
lead_id: lead.id,
|
|
85
|
+
send_at: Time.now + 22.minutes,
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
when ::Office::EmailFilter::KIND_AUTORESPOND_EACT
|
|
89
|
+
::Sch.create({
|
|
90
|
+
email_action: filter.email_action,
|
|
91
|
+
state: ::Sch::STATE_ACTIVE,
|
|
92
|
+
lead_id: lead.id,
|
|
93
|
+
perform_at: Time.now + 22.minutes,
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
else
|
|
97
|
+
raise "unknown filter kind: #{filter.kind}"
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
|
|
61
102
|
end
|
|
62
103
|
::Msg = Office::EmailMessage
|
|
63
104
|
|