wco_email 0.1.1.10 → 0.1.1.12

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: d5e0454d0fd76de0c619c9ea26e84ce685f648e8441c39dacbe89b05fcc21e1a
4
- data.tar.gz: 44b968d0696f37d5375e24c96139ed6aec53ac3f3d77c75d3b9b227f52180e99
3
+ metadata.gz: 12cf9a51987708d2c99caa370d30c2fe09466831e570e76b6ec3d4f43b6e8747
4
+ data.tar.gz: 681fee4ecf20113fb5ef901042326b030de4fa4a08016f9cc31fb5ad1e2e6acd
5
5
  SHA512:
6
- metadata.gz: 868ea88e638147cbba1c6b51a298dadde124c59a31082aa7c96ac71b0dd6fa9998fe4868c5e36d138616101aa0f89b0eac7376098874f199d2ca48afacb5943f
7
- data.tar.gz: dc02b95154d45c05d52a9ef41d4fe6a1508abac22e63df18dc3b15cf1105ca0d01b248cfa29546a0a32a9f0b3b6aae44af2020bc1d1c73761179ddffb6d524bf
6
+ metadata.gz: 27452f09a3756eb4622b51fdd165baa5843bf045fc3f1de1e9b06f66e5954cb321a1dcbe6eebb0a63881809597053906035d05c8dabb20c2c05d2382cb024429
7
+ data.tar.gz: 04c4c2b58ae84f428ff0885630b18e21cda3bbb702e661dd29cd0b2424a67987ba8e1f10daed09375ccdf4ccb859761a96fcdbc59917695041f31bd8f66743fb
@@ -60,7 +60,7 @@ class WcoEmail::EmailFiltersController < WcoEmail::ApplicationController
60
60
  private
61
61
 
62
62
  def set_lists
63
- # super
63
+ @tags_list = Wco::Tag.list
64
64
  @email_templates_list = WcoEmail::EmailTemplate.list
65
65
  @email_actions_list = WcoEmail::EmailAction.list
66
66
  @email_action_templates_list = WcoEmail::EmailActionTemplate.list
@@ -2,6 +2,7 @@
2
2
  require 'aws-sdk-s3'
3
3
  require 'mail'
4
4
  require 'sidekiq'
5
+ require 'exception_notification'
5
6
 
6
7
  ##
7
8
  ## 2023-02-26 _vp_ Let's go
@@ -31,7 +32,7 @@ class WcoEmail::MessageIntakeJob
31
32
  stub = WcoEmail::MessageStub.find id
32
33
  puts "+++ +++ Performing WcoEmail::MessageIntakeJob for object_key `#{stub.object_key}`."
33
34
 
34
- if stub.status != WcoEmail::MessageStub::STATUS_PENDING
35
+ if [ WcoEmail::MessageStub::STATUS_PROCESSED, WcoEmail::MessageStub::STATUS_FAILED ].include?( stub.status )
35
36
  raise "This stub has already been processed: #{stub.id.to_s}."
36
37
  return
37
38
  end
@@ -39,8 +40,9 @@ class WcoEmail::MessageIntakeJob
39
40
  begin
40
41
  stub.do_process
41
42
  rescue => err
43
+ stub.update({ status: WcoEmail::MessageStub::STATUS_FAILED })
42
44
  puts! err, "WcoEmail::MessageIntakeJob error"
43
- ExceptionNotifier.notify_exception(
45
+ ::ExceptionNotifier.notify_exception(
44
46
  err,
45
47
  data: { stub: stub }
46
48
  )
@@ -33,8 +33,8 @@
33
33
  .field
34
34
  = f.label :email_action_template
35
35
  = f.select :email_action_template, options_for_select( @email_action_templates_list, selected: email_filter.email_action_template ), {}, class: 'select2'
36
- -# .field
37
- -# = f.label :wp_term_id
38
- -# = f.select :wp_term_id, options_for_select( @email_tags_list, selected: email_filter.wp_term_id ), {}, class: 'select2'
36
+ .field
37
+ = f.label :tag
38
+ = f.select :tag, options_for_select( @tags_list, selected: email_filter.tag_id ), {}, class: 'select2'
39
39
  .actions
40
40
  = f.submit
@@ -24,9 +24,9 @@
24
24
  %th Subject Exact
25
25
  %th Body Exact
26
26
  %th Kind
27
- -# %th Email Action
28
- %th Email Action Template
29
- -# %th Email Tag
27
+ %th Respond with <br />Email Template
28
+ %th Email Action <br />(template)
29
+ %th Tag
30
30
  - @email_filters.each_with_index do |ef, idx|
31
31
 
32
32
  %tr
@@ -44,8 +44,8 @@
44
44
  %td= ef.subject_exact
45
45
  %td= ef.body_exact
46
46
  %td= ef.kind
47
- -# %td= ef.email_action&.id
47
+ %td= ef.email_template&.slug
48
48
  %td= ef.email_action_template&.slug
49
- -# %td= ef.category&.name
49
+ %td= ef.tag&.slug
50
50
 
51
51
 
@@ -4,14 +4,15 @@ namespace :wco_email do
4
4
  ##
5
5
  ## @stub = WcoEmail::MessageStub.find_by object_key: '2021-10-18T18_41_17Fanand_phoenixwebgroup_co'
6
6
  ##
7
- desc 'churn_n_stubs n=<num> [tagname=<some-new-slug>] [process_images=<false|true>]'
7
+ desc 'churn_n_stubs n=<num> [tagname=<some-new-slug>] [process_images=<false|true>] [status=<status>]'
8
8
  task churn_n_stubs: :environment do
9
9
 
10
10
  ## Usage
11
11
  if !ENV['n']
12
12
  puts ""
13
- puts "Usage: churn_n_stubs n=<num> [tagname=<some-new-slug>] [process_images=<false|true>] "
13
+ puts "Usage: churn_n_stubs n=<num> [tagname=<some-new-slug>] [process_images=<false|true>] [status=<status>] "
14
14
  puts "DOES NOT PROCESS IMAGES BY DEFAULT"
15
+ puts "status can be something other than STATUS_PENDING"
15
16
  puts ""
16
17
  exit 22
17
18
  end
@@ -22,8 +23,11 @@ namespace :wco_email do
22
23
 
23
24
  process_images = ENV['process_images'] == 'true'
24
25
 
26
+ status = ENV['status']
27
+ status ||= WcoEmail::MessageStub::STATUS_PENDING
28
+
25
29
  n = ENV['n'].to_i
26
- stubs = WcoEmail::MessageStub.pending.limit n
30
+ stubs = WcoEmail::MessageStub.where( status: status ).limit n
27
31
  stubs.each_with_index do |stub, idx|
28
32
  puts "+++ +++ churning ##{idx+1} object_key: #{stub.object_key}"
29
33
 
@@ -93,22 +97,24 @@ namespace :wco_email do
93
97
  desc 'import objectkey list'
94
98
  task import_objectkey_list: :environment do
95
99
 
96
- bucket = 'ish-ses'
100
+ # bucket = 'ish-ses'
101
+ bucket = 'ish-test-2024'
97
102
  client ||= Aws::S3::Client.new({
98
103
  region: ::S3_CREDENTIALS[:region_ses],
99
104
  access_key_id: ::S3_CREDENTIALS[:access_key_id_ses],
100
105
  secret_access_key: ::S3_CREDENTIALS[:secret_access_key_ses],
101
106
  })
102
107
 
103
- lines = File.read( './data/20240110_ish-ses_objectkeys' )
108
+ # lines = File.read( './data/20240110_ish-ses_objectkeys' )
109
+ lines = File.read( './data/out_head' )
104
110
  lines.split("\n").each_with_index do |line, idx|
105
111
 
106
112
  object_key = line.split.last
107
113
  stub = WcoEmail::MessageStub.create( object_key: object_key, bucket: bucket )
108
114
  if stub.persisted?
109
- print "#{idx}."
115
+ print "#{idx+1}."
110
116
  else
111
- outs! stub.errors.full_messages.join(", ")
117
+ puts! stub.errors.full_messages.join(", ")
112
118
  end
113
119
 
114
120
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.10
4
+ version: 0.1.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev