wco_email 0.1.1.100 → 0.1.1.102

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: fac4111d9e1e9a7334adf73522d1d8fd3e0cd9496ba0a87449fc88b0d1d07c87
4
- data.tar.gz: 91ebdda9f0946209d1228701ce89a323f7b3d762725cbe3f8458016304981374
3
+ metadata.gz: 72107d308d867b555572bdadf8a11b6ba84fdd12707aef2bb3e6bb12b5cc1928
4
+ data.tar.gz: 78c2c1208b8af74f5df417ac97c7213f21eafb4ec37124f3386c1f3fd41d3e63
5
5
  SHA512:
6
- metadata.gz: bc573d25a79aa071c39ee696b01541e930ff78af4082354ccb311eddf7d7b03dc1a0cc9920a7383a8222d06c8a17157195c36267428056c8f528e82477c360b6
7
- data.tar.gz: 5b629b01858a9d87570bcd1b5f8e5184a9673938470e44e7b055ef71220ce57608e6ec4ab92789864e5442b6de87751ff8b5ec1b5f2293643ad2b6147e27bdd3
6
+ metadata.gz: 8a97196fe771a40d02437520b8e78483c9dd9616d11b5148f7d6425ad67adb744fb5f27fdcdaf39ef75b9e1d69b4bdd4a01cf8fed3e0ec4f6e91484017300e5e
7
+ data.tar.gz: 3e27fc48a527ddc4d0ae6f2a71b24411252de3164ced5539a61f6464ee023602e478a576d464a16d1a4af3404d65fe1e0244019c68bd73ecb98d4884237994fa
@@ -0,0 +1,51 @@
1
+
2
+ class WcoEmail::Api::MessagesController < WcoEmail::ApiController
3
+
4
+ before_action :check_credentials, only: [ :create_email_message ]
5
+ before_action :decode_jwt, except: [ :create_email_message ]
6
+
7
+
8
+ ## 2026-03-27 payload is parsed json.
9
+ def create_postal
10
+ puts! params, 'api/messages#create_postal'
11
+
12
+ ## save to bucket
13
+ @client ||= Aws::S3::Client.new(::SES_S3_CREDENTIALS)
14
+ @client.put_obpect({
15
+ body: params.to_json,
16
+ bucket: ::SES_S3_BUCKET,
17
+ content_type: 'application/json',
18
+ key: params['message_id'],
19
+ })
20
+
21
+ stub = WcoEmail::MessageStub.create({
22
+ bucket: ::SES_S3_BUCKET,
23
+ format: 'json',
24
+ object_key: params['message_id'],
25
+ })
26
+
27
+ WcoEmail::MessageIntakeJob.perform_async( stub.id.to_s )
28
+ render status: :ok, json: { status: :ok }
29
+ end
30
+
31
+
32
+ end
33
+
34
+
35
+
36
+ ## from aws ses
37
+ ## raw email
38
+ ## NEVER BEEN USED!
39
+ =begin
40
+ def create
41
+ puts! params, 'params'
42
+
43
+ stub = WcoEmail::MessageStub.find_or_create_by({
44
+ bucket: params[:bucket],
45
+ object_key: params[:object_key],
46
+ })
47
+
48
+ WcoEmail::MessageIntakeJob.perform_async( stub.id.to_s )
49
+ render status: :ok, json: { status: :ok }
50
+ end
51
+ =end
@@ -1,36 +1,9 @@
1
1
 
2
2
  class WcoEmail::ApiController < ActionController::Base
3
3
 
4
- before_action :check_credentials, only: [ :create_email_message ]
5
- before_action :decode_jwt, except: [ :create_email_message ]
6
4
  skip_before_action :verify_authenticity_token
7
5
  layout false
8
6
 
9
- def create_email_message
10
- puts! params, 'params'
11
-
12
- stub = WcoEmail::MessageStub.find_or_create_by({
13
- bucket: params[:bucket],
14
- object_key: params[:object_key],
15
- })
16
-
17
- WcoEmail::MessageIntakeJob.perform_async( stub.id.to_s )
18
- render status: :ok, json: { status: :ok }
19
- end
20
-
21
- def create_email_message_from_postal
22
- puts! params, 'create_email_message_from_postal#params'
23
-
24
- # stub = WcoEmail::MessageStub.find_or_create_by({
25
- # bucket: params[:bucket],
26
- # object_key: params[:object_key],
27
- # })
28
-
29
- # WcoEmail::MessageIntakeJob.perform_async( stub.id.to_s )
30
- # render status: :ok, json: { status: :ok }
31
- end
32
-
33
-
34
7
 
35
8
  ##
36
9
  ## private
@@ -11,8 +11,9 @@ class WcoEmail::ApplicationController < Wco::ApplicationController
11
11
  ##
12
12
  private
13
13
 
14
- ## Nothing should be here.
14
+
15
15
  def set_lists
16
+ @tags_list = Wco::Tag.list
16
17
  end
17
18
 
18
19
  end
@@ -69,12 +69,15 @@ class WcoEmail::EmailFiltersController < WcoEmail::ApplicationController
69
69
  end
70
70
 
71
71
  flag = @email_filter.update_attributes( params[:email_filter].permit! )
72
+
72
73
  if flag
73
74
  flash[:notice] = 'Success'
75
+ redirect_to action: 'index'
74
76
  else
75
77
  flash[:alert] = "No luck: #{@email_filter.errors.full_messages.join(', ')}."
78
+ redirect_to request.referrer
76
79
  end
77
- redirect_to action: 'index'
80
+
78
81
  end
79
82
 
80
83
  ##
@@ -38,7 +38,11 @@ class WcoEmail::MessageIntakeJob
38
38
  end
39
39
 
40
40
  begin
41
- stub.do_process
41
+ if 'json' == stub.format
42
+ stub.do_process_json ## postal server
43
+ else
44
+ stub.do_process
45
+ end
42
46
  rescue => err
43
47
  stub.update({ status: WcoEmail::MessageStub::STATUS_FAILED })
44
48
  puts! err, "WcoEmail::MessageIntakeJob error"
@@ -1,12 +1,14 @@
1
1
 
2
- .d-flex
3
- .field
4
- %label Field
5
- = f.select :field, options_for_select(WcoEmail::EmailFilter::FIELD_OPTS)
6
- .field
7
- %label Matchtype
8
- = f.select :matchtype, options_for_select(WcoEmail::EmailFilter::MATCHTYPE_OPTS)
9
- .field
10
- %label Value
11
- = f.text_field :value
12
- [-]
2
+ .email-filter-conditions--form.descr
3
+ .d-flex
4
+ .field
5
+ %label Field
6
+ = f.select :field, options_for_select([[nil,nil]] + WcoEmail::EmailFilter::FIELD_OPTS, selected: cond.field )
7
+ .field
8
+ %label Matchtype
9
+ = f.select :matchtype, options_for_select([[nil,nil]] + WcoEmail::EmailFilter::MATCHTYPE_OPTS, selected: cond.matchtype)
10
+ .field
11
+ %label Value
12
+ = f.text_field :value, value: cond.value
13
+ [-]
14
+ -# .a= cond.inspect
@@ -35,11 +35,15 @@
35
35
  %label Kind
36
36
  = f.select :kind, options_for_select( WcoEmail::EmailFilter::KINDS, selected: email_filter.kind )
37
37
  .field
38
- %label Template
38
+ %label Email Template
39
39
  = f.select :email_template_id, options_for_select(@email_templates_list, selected: params[:email_template_id] || email_filter.email_template_id ), {}, { class: 'select2' }
40
40
  .field
41
- = f.label :email_action_template
42
- = f.select :email_action_template, options_for_select( @email_action_templates_list, selected: email_filter.email_action_template_id ), {}, class: 'select2'
41
+ %label Email Action Template
42
+ = f.select :email_action_template_id, options_for_select( @email_action_templates_list, selected: email_filter.email_action_template_id ), {}, class: 'select2'
43
+ .field
44
+ %label Office Action Template
45
+ = f.select :office_action_template_id, options_for_select( ::Wco::OfficeActionTemplate.list, selected: email_filter.office_action_template_id ), {}, class: 'select2'
46
+
43
47
  .field
44
48
  = f.label :tag
45
49
  = f.select :tag, options_for_select( @tags_list, selected: email_filter.tag_id ), {}, class: 'select2'
@@ -52,6 +56,22 @@
52
56
  %label skip from regex
53
57
  = f.text_field :skip_from_regex
54
58
 
55
- .col-md-6
59
+ .col-12
60
+ Conditions:
61
+ %ul
62
+ - email_filter.conditions.each do |cond|
63
+ %li
64
+ = f.fields_for( :conditions ) do |f_cond|
65
+ = render '/wco_email/email_filter_conditions/form', cond: cond, f: f_cond
66
+
67
+ .col-12
68
+ skip conditions:
69
+ %ul
70
+ - email_filter.skip_conditions.each do |cond|
71
+ %li
72
+ = f.fields_for( :skip_conditions ) do |f_cond|
73
+ = render '/wco_email/email_filter_conditions/form', cond: cond, f: f_cond
74
+
75
+ .col-12
56
76
  .actions
57
77
  = f.submit
@@ -28,19 +28,12 @@
28
28
  = f_cond.text_field :value
29
29
  [-]
30
30
  .d-flex [+]
31
- %p Then [test]
32
- - email_filter.action_tmpls.each do |f_act_tmpl|
33
- .d-flex
34
- %label Office Action
35
- .field
36
- %label slug
37
- = f_act_tmpl.slug
38
- .field
39
- %label config
40
- = f_act_tmpl.text_area :config
41
- [-]
42
- .d-flex [+]
43
- [perform]
31
+ %p Then
32
+ .d-flex
33
+ %label OAT
34
+ = f.select :office_action_template, options_for_select(Wco::OfficeActionTemplate.list, selected: email_filter.office_action_template_id), {}, class: 'select2'
35
+
36
+ %p [perform]
44
37
 
45
38
  .actions
46
39
  = f.submit 'Go'
@@ -3,4 +3,4 @@
3
3
  = form_tag email_filters_path, method: :get do
4
4
  = text_field_tag :q
5
5
  = link_to '[+]', new_email_filter_path
6
- = link_to '[2+]', new2_email_filter_path
6
+ = link_to '[+2]', new2_email_filter_path
@@ -3,3 +3,19 @@
3
3
  .header
4
4
  %h2.title Edit Email Filter
5
5
  = render 'form', email_filter: @email_filter
6
+
7
+ -#
8
+ %hr
9
+ <b>Conditions (#{@email_filter.conditions.length}):</b>
10
+ %ul
11
+ - @email_filter.conditions.each do |cond|
12
+ %li
13
+ = cond.inspect
14
+
15
+ %hr
16
+ <b>Skip Conditions (#{@email_filter.skip_conditions.length}):</b>
17
+ %ul
18
+ - @email_filter.skip_conditions.each do |cond|
19
+ %li
20
+ = cond.inspect
21
+
@@ -22,6 +22,8 @@
22
22
  %th Match
23
23
  %th Skip
24
24
  %th Action
25
+ %th Conditions
26
+ %th Skip Conditions
25
27
 
26
28
  - @email_filters.each_with_index do |ef, idx|
27
29
 
@@ -64,6 +66,11 @@
64
66
  - if ef.kind == EF::KIND_REMOVE_TAG
65
67
  .a <b>#{EF::KIND_REMOVE_TAG}:</b> #{ef.tag&.slug}
66
68
 
69
+ %td.conditions
70
+ = ef.conditions.length
71
+ %td.skip-conditions
72
+ = ef.skip_conditions.length
73
+
67
74
  = paginate @email_filters, param_name: WcoEmail::EmailFilter::PAGE_PARAM_NAME, views_prefix: 'wco'
68
75
 
69
76
 
@@ -1,11 +1,18 @@
1
1
 
2
2
  - url = email_template.new_record? ? email_templates_path : email_template_path(email_template.id)
3
3
 
4
- .email-templates--form
4
+ .email-templates--form.container
5
5
  = form_for email_template, as: :template, url: url do |f|
6
- .field
7
- %label Slug
8
- = f.text_field :slug
6
+ .actions
7
+ = f.submit 'Save'
8
+
9
+ .row
10
+ .field.flex-grow-1
11
+ %label Slug
12
+ = f.text_field :slug
13
+ .field
14
+ %label Tag
15
+ = f.select :tag, options_for_select(@tags_list, selected: email_template.tag_id), {}, class: 'select2'
9
16
  .flex-row
10
17
  %label Layout
11
18
  = f.select :layout, options_for_select(WcoEmail::EmailTemplate::LAYOUTS, selected: email_template.layout), {}, class: 'select2'
@@ -4,8 +4,8 @@
4
4
  - else
5
5
  - templates = WcoEmail::EmailTemplate.all
6
6
 
7
- = link_to "Email Templates (#{templates.count})", email_templates_path
8
- = form_tag email_templates_path, method: :get do
7
+ = link_to "Email Templates (#{templates.count})", wco_email.email_templates_path
8
+ = form_tag wco_email.email_templates_path, method: :get do
9
9
  = text_field_tag :q, q
10
- = link_to '[+]', new_email_template_path
11
- = link_to '[expanded]', email_templates_path({ view: '_index_expanded' })
10
+ = link_to '[+]', wco_email.new_email_template_path
11
+ = link_to '[expanded]', wco_email.email_templates_path({ view: '_index_expanded' })
@@ -1,10 +1,11 @@
1
1
 
2
+ - email_templates ||= @templates
3
+
2
4
  .email-templates--index.maxwidth
3
5
 
4
6
  %h5.flex-row.collapse-expand#emailTemplatesIndex
5
- = render '/wco_email/email_templates/header', templates: @templates
7
+ = render '/wco_email/email_templates/header', templates: email_templates
6
8
 
7
- -# = paginate @templates, :param_name => :templates_page, :views_prefix => 'wco'
8
9
  .email-templates-index.maxwidth
9
10
  %table.bordered.data-table
10
11
  %thead
@@ -14,14 +15,14 @@
14
15
  %th Created
15
16
  %th Updated
16
17
 
17
- - @templates.each do |tmpl|
18
+ - email_templates.each do |tmpl|
18
19
  %tr
19
20
  %td
20
21
  .flex-row
21
- = link_to '[use]', new_context_path({ email_template_id: tmpl.id })
22
- = link_to '[~]', edit_email_template_path({ id: tmpl })
23
- = button_to '[x]', email_template_path({ id: tmpl }), method: :delete, :data => { :confirm => 'Are you sure?' }, form_class: 'inline'
24
- %td= link_to tmpl.slug, email_template_path({ id: tmpl })
22
+ = link_to '[use]', wco_email.new_context_path({ email_template_id: tmpl.id })
23
+ = link_to '[~]', wco_email.edit_email_template_path({ id: tmpl })
24
+ = button_to '[x]', wco_email.email_template_path({ id: tmpl }), method: :delete, :data => { :confirm => 'Are you sure?' }, form_class: 'inline'
25
+ %td= link_to tmpl.slug, wco_email.email_template_path({ id: tmpl })
25
26
  %td= pp_date tmpl.created_at
26
27
  %td= pp_date tmpl.updated_at
27
28
  -# = paginate @templates, :param_name => :templates_page, :views_prefix => 'wco'
@@ -0,0 +1,7 @@
1
+ - email_templates ||= @templates
2
+ .email-templates--index.maxwidth
3
+ %ul
4
+ - email_templates.each do |tmpl|
5
+ %li
6
+ = link_to '[~]', wco_email.edit_email_template_path({ id: tmpl })
7
+ = tmpl.to_s
data/config/routes.rb CHANGED
@@ -17,7 +17,7 @@ WcoEmail::Engine.routes.draw do
17
17
  get 'api/email_templates', to: '/wco_email/api/email_templates#index'
18
18
  get 'api/tags/:tagname/conversations', to: '/wco_email/api/conversations#index'
19
19
 
20
- post 'api/messages/from-postal', to: '/wco_email/api#create_email_message'
20
+ post 'api/messages/from-postal/:secret', to: '/wco_email/api/messages#create_postal'
21
21
 
22
22
  get 'conversations/in/:tagname', to: '/wco_email/conversations#index', as: :conversations_in
23
23
  get 'conversations/not-in/:tagname_not', to: '/wco_email/conversations#index', as: :conversations_not_in
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.100
4
+ version: 0.1.1.102
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-05 00:00:00.000000000 Z
11
+ date: 2026-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -314,6 +314,7 @@ files:
314
314
  - app/controllers/wco_email/api/email_action_templates_controller.rb
315
315
  - app/controllers/wco_email/api/email_filters_controller.rb
316
316
  - app/controllers/wco_email/api/email_templates_controller.rb
317
+ - app/controllers/wco_email/api/messages_controller.rb
317
318
  - app/controllers/wco_email/api_controller.rb
318
319
  - app/controllers/wco_email/application_controller.rb
319
320
  - app/controllers/wco_email/contexts_controller.rb
@@ -432,6 +433,7 @@ files:
432
433
  - app/views/wco_email/email_templates/_header.haml
433
434
  - app/views/wco_email/email_templates/_index.haml
434
435
  - app/views/wco_email/email_templates/_index_expanded.haml
436
+ - app/views/wco_email/email_templates/_index_mini.haml
435
437
  - app/views/wco_email/email_templates/_meta.haml
436
438
  - app/views/wco_email/email_templates/_piousbox_social.html.erb
437
439
  - app/views/wco_email/email_templates/_row_col3.html.erb