ishapi 0.1.8.308 → 0.1.8.310

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: d2c02f71e6adddb15a1722d560e9a8b9f56a5a10daa82471cb60bc9b9399000f
4
- data.tar.gz: a3d36b4b360ddf7285ce4950e9d5adb9a784beff39117c4b37a23914234d490c
3
+ metadata.gz: a249c1a6507a0e3898fb1a2cfe93150ec0173a98e936cfdefe70ff994877d0f5
4
+ data.tar.gz: 64b1ac2193477f7762a16c52a34a75c5fc0d0b0de596f80c346df60e97feb8c9
5
5
  SHA512:
6
- metadata.gz: 24949079b8dae5559f5046e42e693610ae5943f9a81fd4e461ee7fa1310998dff2120d60ceaf26b64356bd2d46a98168c0dc9c03e1958f1d4355f9d5a0fd5898
7
- data.tar.gz: fc860e2a11a220c176cd5c67f0d0ce7766f6198dbac1fd50be0cdb4b7fdec44c315587f134e355273413b507c723e70515520772db9101be01233461bfba15bb
6
+ metadata.gz: 557cd50918c4918111b693b73b43b1fafc6bcf516685110f2d81f4144ea655022be2eb2f1125025fe963fc9bca1c66b6b2eb9478ab3a365506d08177dfecc750
7
+ data.tar.gz: 9379e8fd188ebe42e3740dd9e47a1858fb0f576f79eaab77c217b87866a41799ed73688b73d458a07badce7cd1da525f84eb49e60b237fe658d8ae7d1335d86f
@@ -11,7 +11,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
11
11
 
12
12
  =begin
13
13
 
14
- object_key = 'fom5a97nif6j9urfp46sbchi33sks90e9kkrn181'
14
+ object_key = 'k96moravpgg4f976vusakqdaoki97u11i2i3c201'
15
15
  MsgStub.where({ object_key: object_key }).delete
16
16
 
17
17
  stub = MsgStub.create!({ object_key: object_key })
@@ -38,13 +38,12 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
38
38
 
39
39
  raw = client.get_object( bucket: ::S3_CREDENTIALS[:bucket_ses], key: stub.object_key ).body.read
40
40
  the_mail = Mail.new( raw )
41
- message_id = the_mail.header['message-id'].decoded
41
+ message_id = the_mail.header['message-id']&.decoded
42
+ message_id ||= "#{the_mail.date.iso8601}::#{the_mail.from}"
42
43
  in_reply_to_id = the_mail.header['in-reply-to']&.to_s
43
44
  email_inbox_tag_id = WpTag.emailtag(WpTag::INBOX).id
44
45
  the_mail.to = [ 'NO-RECIPIENT' ] if !the_mail.to
45
-
46
- subject = ::Msg.strip_emoji the_mail.subject
47
- subject ||= '(wco-no-subject)'
46
+ subject = ::Msg.strip_emoji( the_mail.subject || '(wco-no-subject)' )
48
47
 
49
48
 
50
49
  ## Conversation
@@ -96,6 +95,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
96
95
  the_mail.parts.each do |part|
97
96
  @message.churn_subpart( part )
98
97
  end
98
+ @message.save
99
99
 
100
100
  if the_mail.parts.length == 0
101
101
  body = the_mail.body.decoded.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
@@ -108,6 +108,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
108
108
  else
109
109
  @message.logs.push "mail body of unknown type: #{the_mail.content_type}"
110
110
  end
111
+ @message.save
111
112
  end
112
113
 
113
114
  ## Attachments
@@ -131,7 +132,9 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
131
132
  email_message: @message,
132
133
  filename: filename,
133
134
  })
134
- if !attachment.save
135
+ begin
136
+ attachment.save
137
+ rescue Encoding::UndefinedConversionError
135
138
  @message.logs.push "Could not save an attachment"
136
139
  end
137
140
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ishapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.308
4
+ version: 0.1.8.310
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox