ishapi 0.1.8.304 → 0.1.8.306
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 +25 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6d7b34491e5a45933183a4f57ffaceca8ad582fded9d3e75435fd33589b18af
|
4
|
+
data.tar.gz: 36680f3eebb3154959f50600d9f5b40fe2dc0679db03105c08fdd365c7301f78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e10c7d52eccd2578dbc67af5aa384916894e57d31619b9fa9e8892ffc78284e1277269826b23b0f2cd827c492b7965afe9169c68d69453a6eabe72a1f1122b9
|
7
|
+
data.tar.gz: 2a1bd018123c3b4282b52c05aaa21b23d5788b54632573cf23f8288b622174658442feaa05a230b5a96194caa1ff519ad07c0a303d55683c106585b040294767
|
@@ -36,8 +36,8 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
36
36
|
secret_access_key: ::S3_CREDENTIALS[:secret_access_key_ses],
|
37
37
|
})
|
38
38
|
|
39
|
-
|
40
|
-
the_mail = Mail.new(
|
39
|
+
raw = client.get_object( bucket: ::S3_CREDENTIALS[:bucket_ses], key: stub.object_key ).body.read
|
40
|
+
the_mail = Mail.new( raw )
|
41
41
|
message_id = the_mail.header['message-id'].decoded
|
42
42
|
in_reply_to_id = the_mail.header['in-reply-to']&.to_s
|
43
43
|
email_inbox_tag_id = WpTag.emailtag(WpTag::INBOX).id
|
@@ -52,7 +52,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
52
52
|
|
53
53
|
@message = ::Office::EmailMessage.where( message_id: message_id ).first
|
54
54
|
@message ||= ::Office::EmailMessage.create({
|
55
|
-
raw:
|
55
|
+
raw: raw,
|
56
56
|
|
57
57
|
message_id: message_id,
|
58
58
|
in_reply_to_id: in_reply_to_id,
|
@@ -75,13 +75,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
75
75
|
# bccs: the_mail.bcc,
|
76
76
|
})
|
77
77
|
if !@message.persisted?
|
78
|
-
|
79
|
-
end
|
80
|
-
if the_mail.body.preamble.present?
|
81
|
-
@message.preamble = the_mail.body.preamble
|
82
|
-
end
|
83
|
-
if the_mail.body.epilogue.present?
|
84
|
-
@message.epilogue = the_mail.body.epilogue
|
78
|
+
throw "Could not create email_message: #{@message.errors.full_messages.join(', ')} ."
|
85
79
|
end
|
86
80
|
|
87
81
|
## Parts
|
@@ -115,15 +109,32 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
115
109
|
photo.decode_base64_image
|
116
110
|
photo.save
|
117
111
|
elsif att.filename
|
112
|
+
filename = CGI.escape( att.filename )
|
113
|
+
|
118
114
|
attachment = Office::EmailAttachment.new({
|
119
115
|
content: att.body.decoded,
|
120
116
|
content_type: att.content_type,
|
121
117
|
email_message: @message,
|
122
|
-
filename:
|
118
|
+
filename: filename,
|
123
119
|
})
|
124
|
-
attachment.save
|
120
|
+
if !attachment.save
|
121
|
+
@message.logs.push "Could not save an attachment"
|
122
|
+
end
|
123
|
+
|
124
|
+
sio = StringIO.new att.body.decoded
|
125
|
+
File.open("/tmp/#{filename}", 'w:UTF-8:ASCII-8BIT') do |f|
|
126
|
+
f.puts(sio.read)
|
127
|
+
end
|
128
|
+
asset3d = ::Gameui::Asset3d.new({
|
129
|
+
object: File.open("/tmp/#{filename}"),
|
130
|
+
email_message: @message,
|
131
|
+
})
|
132
|
+
if !asset3d.save
|
133
|
+
@message.logs.push "Could not save an asset3d"
|
134
|
+
end
|
135
|
+
|
125
136
|
else
|
126
|
-
@message.logs.push "
|
137
|
+
@message.logs.push "Has an attachment with no filename?"
|
127
138
|
end
|
128
139
|
end
|
129
140
|
|
@@ -160,6 +171,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
160
171
|
state: Conv::STATE_UNREAD,
|
161
172
|
latest_at: the_mail.date || Time.now.to_datetime,
|
162
173
|
from_emails: ( conv.from_emails + the_mail.from ).uniq,
|
174
|
+
preview: @message.body_sanitized[0...200],
|
163
175
|
})
|
164
176
|
conv.add_tag( ::WpTag::INBOX )
|
165
177
|
conv_lead_tie = Office::EmailConversationLead.find_or_create_by({
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ishapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.306
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|