ishapi 0.1.8.309 → 0.1.8.312

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb2c27b0e76f833a8c226f0d3b8e2ddde4e79de43410a27d54b17fd7428bb2ea
4
- data.tar.gz: bdfca7a6011021de3e65cbef27bfd89bd0149d249e0f500c8b8f03234126769b
3
+ metadata.gz: a9c71b4515944f778dcb5c20f4ebd7e636d649520fdf5fb9b591b2f602b00c29
4
+ data.tar.gz: '08ff9da2983ffce34144f37430c4e57385726c87af5d873396ceb0bd0f89e7fb'
5
5
  SHA512:
6
- metadata.gz: 9f5c7c049720e975ab0dd41b8704058065b97e1e0e0cdac3d251f92776d771404f4ff3f6897008f09c0b597348e3af0d715028ef98bc0f829074b6a7284bd082
7
- data.tar.gz: 05b52de931750893643cd4a14ebcb6894111602e1f1eadbaa255a34cfbb8b003429837e6f91cf6340995cd815c6b83110c90bbd74b2a3bc92447ce9791fe6a9e
6
+ metadata.gz: 0127b40e3db3f18031980caafeccd5b46aa62c387f22768011a1f913f65e04c526310b076b702a8e00dc466ead15e1561d5e38fcf365fa48ce6194ea4af7ca24
7
+ data.tar.gz: fb487f2236aa645fab4da56f18030874dc42cba4486051ff324446d6990448e337e7c64502fa0773463a9619f79bf3e276501aaffaaf474dce49354095a2362d
@@ -11,7 +11,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
11
11
 
12
12
  =begin
13
13
 
14
- object_key = 'b7t9ns5iqood9edbng1qqh89f2cishcviv1l2ro1'
14
+ object_key = '3c7mvhfual9n8g7b9uhidi00nleeom3gahoe5n01'
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
@@ -114,44 +113,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
114
113
 
115
114
  ## Attachments
116
115
  the_mail.attachments.each do |att|
117
- content_type = att.content_type.split(';')[0]
118
- if content_type.include? 'image'
119
- photo = Photo.new({
120
- content_type: content_type,
121
- original_filename: att.content_type_parameters[:name],
122
- image_data: att.body.encoded,
123
- email_message_id: @message.id,
124
- })
125
- photo.decode_base64_image
126
- photo.save
127
- elsif att.filename
128
- filename = CGI.escape( att.filename )
129
-
130
- attachment = Office::EmailAttachment.new({
131
- content: att.body.decoded,
132
- content_type: att.content_type,
133
- email_message: @message,
134
- filename: filename,
135
- })
136
- if !attachment.save
137
- @message.logs.push "Could not save an attachment"
138
- end
139
-
140
- sio = StringIO.new att.body.decoded
141
- File.open("/tmp/#{filename}", 'w:UTF-8:ASCII-8BIT') do |f|
142
- f.puts(sio.read)
143
- end
144
- asset3d = ::Gameui::Asset3d.new({
145
- object: File.open("/tmp/#{filename}"),
146
- email_message: @message,
147
- })
148
- if !asset3d.save
149
- @message.logs.push "Could not save an asset3d"
150
- end
151
-
152
- else
153
- @message.logs.push "Has an attachment with no filename?"
154
- end
116
+ @message.save_attachment( att )
155
117
  end
156
118
 
157
119
  if !@message.save
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.309
4
+ version: 0.1.8.312
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-19 00:00:00.000000000 Z
11
+ date: 2023-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails