ishapi 0.1.8.215 → 0.1.8.217

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: 908d42fcfe99cabb27c82e7c99144efe71ff92ce74b96bfcf85162b2dd14141c
4
- data.tar.gz: cea7d86798ed13c2835396d141bfc6e796bb45f4ce42508fc9c46ed3a5523ab7
3
+ metadata.gz: b5327c6d97d7c4bbac4285833c8d46f43fe58bb1e011fa730040d252acf4ef2a
4
+ data.tar.gz: dfc315e44f063a8cb1de1b6bede93171477f57c293cae167999573ab70e77e09
5
5
  SHA512:
6
- metadata.gz: a5e3a23fcba44eea22651cdb19e4458bb3e62df19b402ecd64749f9d47ae0c2da185f97a9e47bda05e385c98cadbe51d7e8cca5ea9f225b3862aa4b4d741d26c
7
- data.tar.gz: eb0658150810d1ec02dbe487161fffb4992cb0d67734987b1992f24f7097a88e53cea1010b1de6988b5b6db5d39df9b1577c07eab2ef494f39f4b84e79abcf2d
6
+ metadata.gz: e7910b9bff69f6be9bc29242a348bd6f7f2ab6a58b92c49fa307d33c72aba48ec220fc57bdad5a7fdd10db35676dfd74e708cf1f0d0197ae0323a98bb6f9da0a
7
+ data.tar.gz: e3dced336ce3cfb026bbc8ed14facf33a1a899a20655fa8d8fe31ae5a663e0fef771a958ba20af02c6013533d4352d0df737baeccf400306f3a2dbc7165d0c07
@@ -1,5 +1,9 @@
1
1
 
2
- class Ishapi::ApplicationController < ActionController::Base
2
+ class ::Ishapi::ApplicationController < ActionController::Base
3
+
4
+ def exception
5
+ throw "this exception: #{Time.now}"
6
+ end
3
7
 
4
8
  def home
5
9
  render json: { status: :ok }, status: :ok
@@ -1,37 +1,52 @@
1
1
 
2
2
  require_dependency "ishapi/application_controller"
3
3
 
4
- module Ishapi
5
- class EmailMessagesController < ApplicationController
4
+ class ::Ishapi::EmailMessagesController < ::Ishapi::ApplicationController
6
5
 
7
- before_action :check_jwt, only: [ :show ]
6
+ before_action :check_jwt, only: [ :show ]
7
+ layout false
8
8
 
9
- def show
10
- msg = Office::EmailMessage.find( params[:id] )
11
- authorize! :email_messages_show, ::Ishapi
12
- render json: {
13
- item: msg,
14
- }
15
- end
9
+ def show
10
+ @msg = Office::EmailMessage.find( params[:id] )
11
+ authorize! :show, @msg
16
12
 
17
- ## From lambda, ses
18
- def receive
19
- if params[:secret] != AWS_SES_LAMBDA_SECRET
20
- render status: 400, json: { status: 400 }
21
- return
13
+ if params[:load_images]
14
+ ;
15
+ else
16
+ doc = Nokogiri::HTML(@msg.part_html)
17
+ images = doc.search('img')
18
+ images.each do |img|
19
+ img['src'] = 'missing'
22
20
  end
21
+ @msg.part_html = doc
22
+ end
23
23
 
24
- msg = Office::EmailMessageStub.new({
25
- object_path: params[:object_path],
26
- object_key: params[:object_key],
27
- })
28
- if msg.save
29
- ::Ishapi::EmailMessageIntakeJob.perform_later( msg.id.to_s )
30
- render status: :ok, json: { status: :ok }
31
- else
32
- render status: 400, json: { status: 400 }
24
+ respond_to do |format|
25
+ format.json do
26
+ render json: { item: @msg, }
33
27
  end
28
+ format.html do
29
+ end
30
+ end
31
+ end
32
+
33
+ ## From lambda, ses
34
+ def receive
35
+ if params[:secret] != AWS_SES_LAMBDA_SECRET
36
+ render status: 400, json: { status: 400 }
37
+ return
34
38
  end
35
39
 
40
+ msg = Office::EmailMessageStub.new({
41
+ # object_path: params[:object_path],
42
+ object_key: params[:object_key],
43
+ })
44
+ if msg.save
45
+ ::Ishapi::EmailMessageIntakeJob.perform_later( msg.id.to_s )
46
+ render status: :ok, json: { status: :ok }
47
+ else
48
+ render status: 400, json: { status: 400 }
49
+ end
36
50
  end
51
+
37
52
  end
@@ -7,8 +7,10 @@ stub = Stub.find_by( object_key: m_id_2 )
7
7
  stub.update_attribute(:state, 'state_pending')
8
8
  Ishapi::EmailMessageIntakeJob.perform_now( stub.id.to_s )
9
9
 
10
-
11
10
  =end
11
+
12
+
13
+
12
14
  ##
13
15
  ## 2023-02-26 _vp_ let's go
14
16
  ## 2023-03-02 _vp_ Continue
@@ -49,7 +51,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
49
51
 
50
52
  def perform id
51
53
  stub = ::Office::EmailMessageStub.find id
52
- puts "Performing EmailMessageIntakeJob for message_id #{stub.object_key}"
54
+ puts "Performing EmailMessageIntakeJob for object_key #{stub.object_key}"
53
55
  if stub.state != ::Office::EmailMessageStub::STATE_PENDING
54
56
  raise "This stub has already been processed: #{stub.id.to_s}."
55
57
  return
@@ -61,7 +63,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
61
63
 
62
64
  _mail = client.get_object( bucket: ::S3_CREDENTIALS[:bucket_ses], key: stub.object_key ).body.read
63
65
  the_mail = Mail.new(_mail)
64
- message_id = the_mail.header['message-id'].decoded ## == stub.object_key
66
+ message_id = the_mail.header['message-id'].decoded
65
67
  in_reply_to_id = the_mail.header['in-reply-to']&.to_s
66
68
 
67
69
  @message = ::Office::EmailMessage.where( message_id: message_id ).first
@@ -73,7 +75,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
73
75
  in_reply_to_id: in_reply_to_id,
74
76
 
75
77
  object_key: stub.object_key,
76
- object_path: stub.object_path,
78
+ # object_path: stub.object_path,
77
79
 
78
80
  subject: the_mail.subject,
79
81
  date: the_mail.date,
@@ -7,7 +7,7 @@ class Ishapi::Ability
7
7
  #
8
8
  # signed in user_profile
9
9
  #
10
- if !user_profile.blank?
10
+ if user_profile.present?
11
11
 
12
12
  can [ :my_index ], Gallery
13
13
  can [ :show ], Gallery do |gallery|
@@ -29,13 +29,15 @@ class Ishapi::Ability
29
29
 
30
30
  can [ :buy_stars ], ::Ish::UserProfile
31
31
 
32
- #
33
- # superuser
34
- #
32
+ ##
33
+ ## superuser
34
+ ##
35
35
  if %w| victor@wasya.co victor@piousbox.com piousbox@gmail.com |.include?( user_profile.email )
36
+ puts! user_profile, 'ze profile'
37
+
36
38
  can [ :email_conversations_delete ], ::Ishapi
37
39
 
38
- can [ :email_messages_show ], ::Ishapi
40
+ can [ :show ], ::Office::EmailMessage
39
41
  end
40
42
 
41
43
  end
@@ -0,0 +1,3 @@
1
+
2
+ %html
3
+ %body{ style: 'background: white' }= raw @msg.part_html
data/config/routes.rb CHANGED
@@ -4,13 +4,23 @@ Ishapi::Engine.routes.draw do
4
4
  root :to => 'application#home'
5
5
  post 'home', :to => 'application#home'
6
6
 
7
+ # A
7
8
  resources :addresses
8
9
 
10
+ # E
11
+ post 'email_messages', to: 'email_messages#receive'
12
+ get 'email_messages/:id', to: 'email_messages#show', as: :email_message
13
+
14
+ delete 'email_conversations', to: 'email_conversations#delete'
15
+
16
+ # G
9
17
  get 'galleries', :to => 'galleries#index'
10
18
  post 'galleries', :to => 'galleries#index'
11
19
  get 'galleries/view/:slug', :to => 'galleries#show'
12
20
  post 'galleries/view/:slug', :to => 'galleries#show'
13
21
 
22
+ # H
23
+ # I
14
24
  post 'invoices/search', :to => 'invoices#search'
15
25
 
16
26
  # L
@@ -31,11 +41,6 @@ Ishapi::Engine.routes.draw do
31
41
  # N
32
42
  delete 'newsitems/:id', to: 'newsitems#destroy'
33
43
 
34
- post 'email_messages', to: 'email_messages#receive'
35
- get 'email_messages/:id', to: 'email_messages#show'
36
-
37
- delete 'email_conversations', to: 'email_conversations#delete'
38
-
39
44
  post 'do_purchase', to: 'gameui#do_purchase' # @TODO: rename to just purchase, or destroy endpoint
40
45
  post 'payments', :to => 'payments#create'
41
46
  post 'payments2', :to => 'payments#create2' # @TODO: change
@@ -54,7 +59,8 @@ Ishapi::Engine.routes.draw do
54
59
  get 'option_price_items/view/:symbol/from/:begin_at/to/:end_at', to: 'option_price_items#view'
55
60
 
56
61
 
57
- get 'test', to: 'application#test'
62
+ get 'test', to: 'application#test'
63
+ get 'exception', to: 'application#exception'
58
64
 
59
65
  post 'users/fb_sign_in', to: 'users#fb_sign_in'
60
66
  get 'users/me', to: 'users#account'
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.215
4
+ version: 0.1.8.217
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-10 00:00:00.000000000 Z
11
+ date: 2023-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -241,6 +241,7 @@ files:
241
241
  - app/views/ishapi/application/_meta.jbuilder
242
242
  - app/views/ishapi/application/_pagination.jbuilder
243
243
  - app/views/ishapi/application_mailer/forwarder_notify.html.erb
244
+ - app/views/ishapi/email_messages/show.haml
244
245
  - app/views/ishapi/galleries/_index.jbuilder
245
246
  - app/views/ishapi/galleries/_show.jbuilder
246
247
  - app/views/ishapi/galleries/index.jbuilder