ishapi 0.1.8.306 → 0.1.8.307
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 +23 -20
- 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: ddd9993a231d5fa7e5124886794d99afe3e8c5b101b3f38c93e86053ca57ba57
|
4
|
+
data.tar.gz: 6fcf6829d0dd86abeedef28fddc382dd1449a1aef91b081fc4468dbc2987b442
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e16e4c44484b581fac511854fa67efde229173288908ce45b6cb5e271ac0e890a66bfd6338a90919d0ddad6ebd637dc11b4be01cc9a22d0ef93ca4eb39d99ad5
|
7
|
+
data.tar.gz: 18061bb332133a4f4f4358d5aa35f05cbace58242ca234d3285e7ec2c1dc4e09fdadf020743156a20e29d3dbdd42580213948a7b6e648fafe5b06741ff3da836
|
@@ -11,7 +11,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
11
11
|
|
12
12
|
=begin
|
13
13
|
|
14
|
-
object_key = '
|
14
|
+
object_key = 'fom5a97nif6j9urfp46sbchi33sks90e9kkrn181'
|
15
15
|
MsgStub.where({ object_key: object_key }).delete
|
16
16
|
|
17
17
|
stub = MsgStub.create!({ object_key: object_key })
|
@@ -50,9 +50,30 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
50
50
|
subject = ::Msg.strip_emoji the_mail.subject
|
51
51
|
subject ||= '(wco no subject)'
|
52
52
|
|
53
|
+
|
54
|
+
## Conversation
|
55
|
+
if in_reply_to_id
|
56
|
+
in_reply_to_msg = ::Office::EmailMessage.where({ message_id: in_reply_to_id }).first
|
57
|
+
if !in_reply_to_msg
|
58
|
+
conv = ::Office::EmailConversation.find_or_create_by({
|
59
|
+
subject: subject,
|
60
|
+
})
|
61
|
+
in_reply_to_msg = ::Office::EmailMessage.find_or_create_by({
|
62
|
+
message_id: in_reply_to_id,
|
63
|
+
email_conversation_id: conv.id,
|
64
|
+
})
|
65
|
+
end
|
66
|
+
conv = in_reply_to_msg.email_conversation
|
67
|
+
else
|
68
|
+
conv = ::Office::EmailConversation.find_or_create_by({
|
69
|
+
subject: subject,
|
70
|
+
})
|
71
|
+
end
|
72
|
+
|
53
73
|
@message = ::Office::EmailMessage.where( message_id: message_id ).first
|
54
74
|
@message ||= ::Office::EmailMessage.create({
|
55
75
|
raw: raw,
|
76
|
+
email_conversation_id: conv.id,
|
56
77
|
|
57
78
|
message_id: message_id,
|
58
79
|
in_reply_to_id: in_reply_to_id,
|
@@ -148,25 +169,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
148
169
|
Lead.find_or_create_by( email: cc, m3_leadset_id: leadset.id )
|
149
170
|
end
|
150
171
|
|
151
|
-
|
152
|
-
if in_reply_to_id
|
153
|
-
in_reply_to_msg = ::Office::EmailMessage.where({ message_id: in_reply_to_id }).first
|
154
|
-
if !in_reply_to_msg
|
155
|
-
conv = ::Office::EmailConversation.find_or_create_by({
|
156
|
-
subject: @message.subject,
|
157
|
-
})
|
158
|
-
in_reply_to_msg = ::Office::EmailMessage.find_or_create_by({
|
159
|
-
message_id: in_reply_to_id,
|
160
|
-
email_conversation_id: conv.id,
|
161
|
-
})
|
162
|
-
end
|
163
|
-
conv = in_reply_to_msg.email_conversation
|
164
|
-
else
|
165
|
-
conv = ::Office::EmailConversation.find_or_create_by({
|
166
|
-
subject: @message.subject,
|
167
|
-
})
|
168
|
-
end
|
169
|
-
@message.update_attributes({ email_conversation_id: conv.id })
|
172
|
+
# @message.update_attributes({ email_conversation_id: conv.id })
|
170
173
|
conv.update_attributes({
|
171
174
|
state: Conv::STATE_UNREAD,
|
172
175
|
latest_at: the_mail.date || Time.now.to_datetime,
|