ishapi 0.1.8.285 → 0.1.8.286

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: 76230270153711c6dff30ead344469cd8df42e084832e931351a291879ea3557
4
- data.tar.gz: 361989859dd3015a7d93de1348301e4038b5709adac5736c22820e7d413fdaa4
3
+ metadata.gz: f5c0832ec3c2109607e7d612d9daf38dbff6e2b710879710f71e358ed5304ea3
4
+ data.tar.gz: e2ad530fe9863aa53e532b1e37ab628a179b49da40a5edb31fd4c0abe080e721
5
5
  SHA512:
6
- metadata.gz: 60e0f42fa6405907798a1cd4d24633059768206fd26203101099cf3b1e8bba2f9bc089a318f7b2112fbfbe1432a88563a0e80126b1e17f97b9243d73d414dd1e
7
- data.tar.gz: ccd7a99f503e51818998b2629bd7bd8f02b365db37a942550c9129bdf2c92e4b8bd8d9ebd54e085a3331f5fb292f57b1576f33cf785d141609a54e221d3e3487
6
+ metadata.gz: 15b2df35cdc3dde6cece928bdf20427f4603b82de04e52cb9ca901ba1ebade45d338487d80de8013f87fc3a9225158d6ee46dafdf041bcfdd0f003cee23fc46d
7
+ data.tar.gz: 6cdaba9a607c484cff7a481e2edbe50071a3ec3ea3881392487f8406f85a0bebacfda86842a2bb83ed6297692d9a509a64dcad54f66cc2ec338076e83e5b36c1
@@ -7,7 +7,7 @@ module Ishapi
7
7
  before_action :check_jwt
8
8
 
9
9
  def index
10
- @galleries = Gallery.all.public
10
+ @galleries = Gallery.all.published
11
11
  authorize! :index, Gallery
12
12
  if params[:domain]
13
13
  @site = Site.find_by( :domain => params[:domain], :lang => 'en' )
@@ -9,7 +9,7 @@ module Ishapi
9
9
 
10
10
  def index
11
11
  authorize! :index, Video
12
- @videos = Video.all.public
12
+ @videos = Video.all.published
13
13
  @videos = @videos.page( params[:videos_page] ).per( 10 )
14
14
  end
15
15
 
@@ -1,15 +1,12 @@
1
1
 
2
2
  ##
3
3
  ## 2023-02-26 _vp_ Let's go
4
- ## 2023-03-02 _vp_ Continue
5
4
  ## 2023-03-07 _vp_ Continue
6
5
  ##
7
6
  ## class name: EIJ
8
7
  ##
9
8
  class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
10
9
 
11
- # include Sidekiq::Worker ## From: https://stackoverflow.com/questions/59114063/sidekiq-options-giving-sidekiqworker-cannot-be-included-in-an-activejob-for
12
-
13
10
  queue_as :default
14
11
 
15
12
  ## For recursive parts of type `related`.
@@ -59,7 +56,8 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
59
56
  client = Aws::S3::Client.new({
60
57
  region: ::S3_CREDENTIALS[:region_ses],
61
58
  access_key_id: ::S3_CREDENTIALS[:access_key_id_ses],
62
- secret_access_key: ::S3_CREDENTIALS[:secret_access_key_ses] })
59
+ secret_access_key: ::S3_CREDENTIALS[:secret_access_key_ses],
60
+ })
63
61
 
64
62
  _mail = client.get_object( bucket: ::S3_CREDENTIALS[:bucket_ses], key: stub.object_key ).body.read
65
63
  the_mail = Mail.new(_mail)
@@ -71,7 +69,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
71
69
  the_mail.to = [ 'NO-RECIPIENT' ]
72
70
  end
73
71
 
74
- @message = ::Office::EmailMessage.where( message_id: message_id ).first
72
+ @message = ::Office::EmailMessage.where( message_id: message_id ).first
75
73
  @message ||= ::Office::EmailMessage.new
76
74
  @message.assign_attributes({
77
75
  raw: _mail,
@@ -101,21 +99,11 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
101
99
  @message.epilogue = the_mail.body.epilogue
102
100
  end
103
101
 
102
+ ## Parts
104
103
  the_mail.parts.each do |part|
105
104
  churn_subpart( @message, part )
106
105
  end
107
106
 
108
- the_mail.attachments.each do |att|
109
- photo = Photo.new({
110
- content_type: att.content_type.split(';')[0],
111
- original_filename: att.content_type_parameters[:name],
112
- image_data: att.body.encoded,
113
- email_message_id: @message.id,
114
- })
115
- photo.decode_base64_image
116
- photo.save
117
- end
118
-
119
107
  if the_mail.parts.length == 0
120
108
  body = the_mail.body.decoded.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
121
109
  if the_mail.content_type.include?('text/html')
@@ -127,6 +115,18 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
127
115
  end
128
116
  end
129
117
 
118
+ ## Attachments
119
+ the_mail.attachments.each do |att|
120
+ photo = Photo.new({
121
+ content_type: att.content_type.split(';')[0],
122
+ original_filename: att.content_type_parameters[:name],
123
+ image_data: att.body.encoded,
124
+ email_message_id: @message.id,
125
+ })
126
+ photo.decode_base64_image
127
+ photo.save
128
+ end
129
+
130
130
  ## Leadset, Lead
131
131
  domain = @message.from.split('@')[1]
132
132
  leadset = Leadset.find_or_create_by( company_url: domain )
@@ -154,9 +154,10 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
154
154
  conv.update_attributes({
155
155
  state: Conv::STATE_UNREAD,
156
156
  latest_at: the_mail.date || Time.now.to_datetime,
157
- lead_ids: conv.lead_ids.push( lead.id ).uniq,
158
- wp_term_ids: ( [ email_inbox_tag_id ] + conv.wp_term_ids + stub.wp_term_ids ).uniq,
157
+ lead_ids: conv.lead_ids.push( lead.id ).uniq, ## @TODO: change, this is an association now
158
+ # wp_term_ids: ( [ email_inbox_tag_id ] + conv.wp_term_ids + stub.wp_term_ids ).uniq,
159
159
  })
160
+ conv.add_tag( ::WpTag::INBOX )
160
161
 
161
162
  ## Actions & Filters
162
163
  email_filters = Office::EmailFilter.active
@@ -169,15 +170,15 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
169
170
 
170
171
  # || MiaTagger.analyze( @message.part_html, :is_spammy_recruite ).score > .5
171
172
 
172
- @message.apply_filter( filter )
173
+ conv.apply_filter( filter )
173
174
  end
174
175
  end
175
176
 
176
177
  stub.update_attributes({ state: ::Office::EmailMessageStub::STATE_PROCESSED })
177
178
 
178
179
  ## Notification
179
- conv.reload
180
- if conv.wp_term_ids.include?( email_inbox_tag_id )
180
+ conv = Conv.find( conv.id )
181
+ if conv.in_emailtag? WpTag::INBOX
181
182
  out = ::Ishapi::ApplicationMailer.forwarder_notify( @message.id.to_s )
182
183
  Rails.env.production? ? out.deliver_later : out.deliver_now
183
184
  end
@@ -1,2 +1,15 @@
1
1
 
2
- FWD_Notify: No content
2
+ <ul>
3
+ <li><b>From:</b> <%= @msg.from %></li>
4
+ <li><b>To:</b> <%= @msg.to %></li>
5
+ <li><b>Subject:</b> <%= @msg.subject %></li>
6
+ <li><b>Date:</b> <%= @msg.date %></li>
7
+ <li><b>N Attachments:</b> <%= @msg.attachments.length %></li>
8
+ </ul>
9
+
10
+ <%= raw @msg.part_html %>
11
+
12
+ <hr />
13
+
14
+ <%= raw @msg.part_txt %>
15
+
data/lib/ishapi.rb CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
- require "ishapi/engine"
3
2
  require 'cancancan'
4
- require 'kaminari/mongoid'
3
+ require "ishapi/engine"
5
4
  require 'kaminari/actionview'
5
+ require 'kaminari/mongoid'
6
6
 
7
7
  module Ishapi
8
8
  end
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.285
4
+ version: 0.1.8.286
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-19 00:00:00.000000000 Z
11
+ date: 2023-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails