ishapi 0.1.8.285 → 0.1.8.287

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: 76230270153711c6dff30ead344469cd8df42e084832e931351a291879ea3557
4
- data.tar.gz: 361989859dd3015a7d93de1348301e4038b5709adac5736c22820e7d413fdaa4
3
+ metadata.gz: 848f93e47f25769c13743858765a6f9ea58a476e33e8e471d39c80cb5f3f6f0a
4
+ data.tar.gz: df675720a5fa2df39fb76e7f5c0e8a0241001b6b5a0d5ac5a5f36ebbed70d5c3
5
5
  SHA512:
6
- metadata.gz: 60e0f42fa6405907798a1cd4d24633059768206fd26203101099cf3b1e8bba2f9bc089a318f7b2112fbfbe1432a88563a0e80126b1e17f97b9243d73d414dd1e
7
- data.tar.gz: ccd7a99f503e51818998b2629bd7bd8f02b365db37a942550c9129bdf2c92e4b8bd8d9ebd54e085a3331f5fb292f57b1576f33cf785d141609a54e221d3e3487
6
+ metadata.gz: 84cb613fc995cd5f18a5b0180fad76079c7e272f71cfd0d009dff8df77d6e342b4f97dad0531a205bf014916cfc862b6b41cb15d2090e7f03280f82363507887
7
+ data.tar.gz: b8e916b519f7b191643af5bbe2050bc4056f1d569a9dff5c38cf65bd4163ae62700d4c1845bee05336212565360f7c63ceb9ed7ab9cf350142c6000b2fa99cbf
@@ -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,10 +154,15 @@ 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
+ from_emails: conv.from_emails.push( the_mail.from[0] ).uniq,
158
+ })
159
+ conv.add_tag( ::WpTag::INBOX )
160
+ conv_lead_tie = Office::EmailConversationLead.find_or_create_by({
161
+ lead_id: lead.id,
162
+ email_conversation_id: conv.id,
159
163
  })
160
164
 
165
+
161
166
  ## Actions & Filters
162
167
  email_filters = Office::EmailFilter.active
163
168
  email_filters.each do |filter|
@@ -169,15 +174,15 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
169
174
 
170
175
  # || MiaTagger.analyze( @message.part_html, :is_spammy_recruite ).score > .5
171
176
 
172
- @message.apply_filter( filter )
177
+ conv.apply_filter( filter )
173
178
  end
174
179
  end
175
180
 
176
181
  stub.update_attributes({ state: ::Office::EmailMessageStub::STATE_PROCESSED })
177
182
 
178
183
  ## Notification
179
- conv.reload
180
- if conv.wp_term_ids.include?( email_inbox_tag_id )
184
+ conv = Conv.find( conv.id )
185
+ if conv.in_emailtag? WpTag::INBOX
181
186
  out = ::Ishapi::ApplicationMailer.forwarder_notify( @message.id.to_s )
182
187
  Rails.env.production? ? out.deliver_later : out.deliver_now
183
188
  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.287
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