ishapi 0.1.8.220 → 0.1.8.222
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: 79a045487ac24d706f7d8f02f10a548153673b0b0b13bb151fb284a3ccb3837e
|
4
|
+
data.tar.gz: '08a915a9769757ec0519b5171ac2bbb17d9cc431af3dbea113b9558e1a090403'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c144dc50c96c1e6e684e064f1ff1696aba730573eccc9dc4673ab7fe35f3469cc995fdf0d2bcfee4e60b1f0c50aa81fadecac44ae53c354aeb888b69811110
|
7
|
+
data.tar.gz: 5338869bbdd4d2762a050b60eccd91b8feaaed1613a9569ba0afb9e62b3419012d2a54f5400ee4dc1400976bbb20dd5fc7f14f738b1de498a056e734d7567b50
|
@@ -9,7 +9,19 @@ Ishapi::EmailMessageIntakeJob.perform_now( stub.id.to_s )
|
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
12
|
-
|
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
|
13
25
|
|
14
26
|
##
|
15
27
|
## 2023-02-26 _vp_ let's go
|
@@ -98,54 +110,43 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
98
110
|
if in_reply_to_id
|
99
111
|
in_reply_to_msg = ::Office::EmailMessage.where({ message_id: in_reply_to_id }).first
|
100
112
|
if !in_reply_to_msg
|
101
|
-
conv = ::Office::EmailConversation.
|
113
|
+
conv = ::Office::EmailConversation.find_or_create_by({
|
102
114
|
subject: the_mail.subject,
|
103
|
-
latest_at: the_mail.date,
|
104
115
|
})
|
105
|
-
in_reply_to_msg = ::Office::EmailMessage.
|
116
|
+
in_reply_to_msg = ::Office::EmailMessage.find_or_create_by({
|
106
117
|
message_id: in_reply_to_id,
|
107
118
|
email_conversation_id: conv.id,
|
108
119
|
})
|
109
120
|
end
|
110
121
|
conv = in_reply_to_msg.email_conversation
|
111
122
|
else
|
112
|
-
conv = ::Office::EmailConversation.
|
123
|
+
conv = ::Office::EmailConversation.find_or_create_by({
|
113
124
|
subject: the_mail.subject,
|
114
|
-
latest_at: the_mail.date,
|
115
125
|
})
|
116
126
|
end
|
117
127
|
@message.email_conversation_id = conv.id
|
118
128
|
conv.update_attributes({
|
119
129
|
state: Conv::STATE_UNREAD,
|
120
130
|
latest_at: the_mail.date,
|
121
|
-
|
131
|
+
wp_term_ids: ( [ WpTag.email_inbox_tag.id ] + conv.wp_term_ids + stub.wp_term_ids ).uniq,
|
122
132
|
})
|
123
133
|
|
124
134
|
## Leadset
|
125
135
|
domain = @message.from.split('@')[1]
|
126
|
-
leadset = Leadset.
|
127
|
-
if !leadset
|
128
|
-
leadset = Leadset.create!( company_url: domain, name: domain )
|
129
|
-
end
|
136
|
+
leadset = Leadset.find_or_create_by( company_url: domain )
|
130
137
|
|
131
138
|
## Lead
|
132
|
-
lead = Lead.
|
133
|
-
if !lead
|
134
|
-
lead = Lead.new( email: @message.from )
|
135
|
-
lead.leadsets.push( leadset )
|
136
|
-
lead.save!
|
137
|
-
end
|
139
|
+
lead = Lead.find_or_create_by( email: @message.from, m3_leadset_id: leadset.id )
|
138
140
|
conv.lead_ids = conv.lead_ids.push( lead.id ).uniq
|
139
141
|
|
140
142
|
## Actions & Filters
|
141
|
-
inbox_tag = WpTag.email_inbox_tag
|
142
|
-
@message.add_tag( inbox_tag )
|
143
|
-
conv.add_tag( inbox_tag )
|
143
|
+
# inbox_tag = WpTag.email_inbox_tag
|
144
|
+
# @message.add_tag( inbox_tag )
|
145
|
+
# conv.add_tag( inbox_tag )
|
144
146
|
|
145
147
|
email_filters = Office::EmailFilter.active
|
146
148
|
email_filters.each do |filter|
|
147
149
|
if @message.from.match( filter.from_regex ) # || @message.part_html.match( filter.body_regex ) ) # || MiaTagger.analyze( @message.part_html, :is_spammy_recruite ).score > .5
|
148
|
-
|
149
150
|
@message.apply_filter( filter )
|
150
151
|
end
|
151
152
|
end
|