ishapi 0.1.8.304 → 0.1.8.305

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: c2aa5889cc1b26469a45c1177f999974ab3c8d3dead962628024eaf53b22ffdf
4
- data.tar.gz: ac848af52069580c948d4f9f25b3bb909b9114647bcdb2dd967dd963dc548513
3
+ metadata.gz: fc372746027421f9ac7c60e85da6d38c0032e9a8070a8ae3d43e360406896fba
4
+ data.tar.gz: c55c1545c1f1dd9fb02933362c60129c3856831250e8855042edb3a1eb9260b2
5
5
  SHA512:
6
- metadata.gz: c3702b34c60967c73931108100513252416ba21dec37e7365276ec2c4eee3b97135d275f19c50b80b0a9611c3cbfdf5eb84d84ac75d30a2ca5842acb948be1a9
7
- data.tar.gz: e540871e032d8f92633ad726ba51b6e17b14430688ea7af76637f880ec54676fbbb55c4fd0ae6ef8a31dccb883f460143844a5fdefac118586110ce19a0227dd
6
+ metadata.gz: cd966429e4ddadd59d1464c3fb93161d5f232db3045a3af8b474bf8d56275f689745c509360b6ab42e5a11ac50d693c73ea4c99b21b0acd07b8723b05b4d2bdb
7
+ data.tar.gz: 108f40bb94ade6afededba38d9c0e9edef891b2e746bb16108a8719669d056e1b6b40d5bb3a21289ed8dac022c73c3015a7bc796596678b8c1db105e4948750b
@@ -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
- _mail = client.get_object( bucket: ::S3_CREDENTIALS[:bucket_ses], key: stub.object_key ).body.read
40
- the_mail = Mail.new(_mail)
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: _mail,
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
- puts! @message.errors.full_messages, "Could not create email_message"
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
@@ -160,6 +154,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
160
154
  state: Conv::STATE_UNREAD,
161
155
  latest_at: the_mail.date || Time.now.to_datetime,
162
156
  from_emails: ( conv.from_emails + the_mail.from ).uniq,
157
+ preview: @message.body_sanitized[0...200],
163
158
  })
164
159
  conv.add_tag( ::WpTag::INBOX )
165
160
  conv_lead_tie = Office::EmailConversationLead.find_or_create_by({
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.304
4
+ version: 0.1.8.305
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox