ishapi 0.1.8.222 → 0.1.8.223
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/jobs/ishapi/email_message_intake_job.rb +7 -23
- 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: 4713c8ceb10373af0516bafd1226ca2aab981755fb4792b049b142b58143696d
|
4
|
+
data.tar.gz: 1f2b36b9ab6768e32fe18d18d74cf0713ddffe28b198d0aed5018ba8b2877560
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31fca4d7d89ccb14e14c52771352a7183d6104be3b785e9a703a5acb488d0e2910f2fae836791e3e55b80b5f2d86c66bb05887d24307fd41845b2d4b92bfc168
|
7
|
+
data.tar.gz: b9cc541f597e7aa1d13fadf51be0ca282293f7be2c4dfc0b33f212d3c495372a894e771835d876a91f04c8951756efcce00479539b611cc3411a42388203e7e0
|
@@ -9,19 +9,6 @@ Ishapi::EmailMessageIntakeJob.perform_now( stub.id.to_s )
|
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
12
|
-
## align companies do leads' domains
|
13
|
-
=begin
|
14
|
-
outs = Lead.all.map do |lead|
|
15
|
-
domain = lead.email.split('@')[1]
|
16
|
-
if lead.company.company_url == domain
|
17
|
-
;
|
18
|
-
else
|
19
|
-
company = Leadset.find_or_create_by( company_url: domain )
|
20
|
-
lead.m3_leadset_id = company.id
|
21
|
-
lead.save
|
22
|
-
end
|
23
|
-
end.compact
|
24
|
-
=end
|
25
12
|
|
26
13
|
##
|
27
14
|
## 2023-02-26 _vp_ let's go
|
@@ -73,10 +60,11 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
73
60
|
access_key_id: ::S3_CREDENTIALS[:access_key_id],
|
74
61
|
secret_access_key: ::S3_CREDENTIALS[:secret_access_key] })
|
75
62
|
|
76
|
-
_mail
|
77
|
-
the_mail
|
78
|
-
message_id
|
79
|
-
in_reply_to_id
|
63
|
+
_mail = client.get_object( bucket: ::S3_CREDENTIALS[:bucket_ses], key: stub.object_key ).body.read
|
64
|
+
the_mail = Mail.new(_mail)
|
65
|
+
message_id = the_mail.header['message-id'].decoded
|
66
|
+
in_reply_to_id = the_mail.header['in-reply-to']&.to_s
|
67
|
+
email_inbox_tag_id = WpTag.email_inbox_tag.id
|
80
68
|
|
81
69
|
@message = ::Office::EmailMessage.where( message_id: message_id ).first
|
82
70
|
@message ||= ::Office::EmailMessage.new
|
@@ -128,7 +116,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
128
116
|
conv.update_attributes({
|
129
117
|
state: Conv::STATE_UNREAD,
|
130
118
|
latest_at: the_mail.date,
|
131
|
-
wp_term_ids: ( [
|
119
|
+
wp_term_ids: ( [ email_inbox_tag_id ] + conv.wp_term_ids + stub.wp_term_ids ).uniq,
|
132
120
|
})
|
133
121
|
|
134
122
|
## Leadset
|
@@ -140,10 +128,6 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
140
128
|
conv.lead_ids = conv.lead_ids.push( lead.id ).uniq
|
141
129
|
|
142
130
|
## Actions & Filters
|
143
|
-
# inbox_tag = WpTag.email_inbox_tag
|
144
|
-
# @message.add_tag( inbox_tag )
|
145
|
-
# conv.add_tag( inbox_tag )
|
146
|
-
|
147
131
|
email_filters = Office::EmailFilter.active
|
148
132
|
email_filters.each do |filter|
|
149
133
|
if @message.from.match( filter.from_regex ) # || @message.part_html.match( filter.body_regex ) ) # || MiaTagger.analyze( @message.part_html, :is_spammy_recruite ).score > .5
|
@@ -162,7 +146,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
162
146
|
stub.update_attributes({ state: ::Office::EmailMessageStub::STATE_PROCESSED })
|
163
147
|
|
164
148
|
## Notification
|
165
|
-
if @message.wp_term_ids.include?(
|
149
|
+
if @message.wp_term_ids.include?( email_inbox_tag_id )
|
166
150
|
# @TODO: send android notification _vp_ 2023-03-01
|
167
151
|
::Ishapi::ApplicationMailer.forwarder_notify( @message.id.to_s ).deliver_later
|
168
152
|
end
|