ish_manager 0.1.8.482 → 0.1.8.484

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: ffdc32adef458690157844637f8163dba42ca7b91627905a2986d00ed66ca642
4
- data.tar.gz: bb0cb14a835b5ae21f97b110358684ba5e0b0ace4bf047afb27d0d022c5ba2e0
3
+ metadata.gz: fcdbbd6567ea0470001b2510d9a9cbb8b4c7d80d7039dbb59f59752db43c97e5
4
+ data.tar.gz: 1f61f7669a0a7e7cb86a70b3e58f9c56c6d394499ca9665b0f3aacad91d75358
5
5
  SHA512:
6
- metadata.gz: 45b687f013ff078b30918294bea4e0253a4ee93f1ef3384336212531267618aeea2aa37e5daadab2a60520c23e96e59cd60d5c7be9cbd44e4210cd858526f042
7
- data.tar.gz: 82c914b43dc8c3b46f77a43942136c71476650e6ecb554dbd51b8cfc697bd18c51b1d04c57efd2db8871fdb0f74ab67c99d630c47eec8d15c24977fae2c5bb5f
6
+ metadata.gz: ed089955bc512e0181fcfbca592a8279c0213472d3cf461d015aae01d9ac0aba1870b04cc0fd04e6f3495f0e00cad0a19fa5d0e5243f25370b943ee63a44de7e
7
+ data.tar.gz: c8bc7f3d499733d6fdc3eae89e68fc35f47c97486b6628ef92784957d68e4f6df7bdd8307f47cd44501ab3193609b9d80ee5d297549adbf6c9ede939f46c101b
@@ -47,9 +47,10 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
47
47
  @ctx = @email_context = Ish::EmailContext.find params[:id]
48
48
  authorize! :iframe_src, @ctx
49
49
 
50
- @tmpl = @email_template = @ctx.email_template
51
- @lead = @ctx.lead
52
- @body = @ctx.body
50
+ @tmpl = @email_template = @ctx.email_template
51
+ @tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
52
+ @lead = @ctx.lead
53
+ @body = @ctx.body
53
54
 
54
55
  render layout: false
55
56
  end
@@ -65,9 +66,9 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
65
66
  @ctxs = @ctxs.where( lead_id: @lead.id )
66
67
  else
67
68
  if my_truthy? params[:sent]
68
- @ctxs = @ctxs.where( :sent_at.ne => nil )
69
+ @ctxs = @ctxs.or({ :sent_at.ne => nil }, { :unsubscribed_at.ne => nil })
69
70
  else
70
- @ctxs = @ctxs.where( sent_at: nil )
71
+ @ctxs = @ctxs.where( sent_at: nil, unsubscribed_at: nil )
71
72
  end
72
73
  end
73
74
  end
@@ -87,7 +88,7 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
87
88
  def send_immediate
88
89
  @ctx = ::Ish::EmailContext.find params[:id]
89
90
  authorize! :do_send, @ctx
90
- flash[:notice] = 'Sent immediately.'
91
+ flash_notice 'Sent immediately.'
91
92
 
92
93
  out = IshManager::OfficeMailer.send_context_email( @ctx[:id].to_s )
93
94
  Rails.env.production? ? out.deliver_later : out.deliver_now
@@ -35,8 +35,9 @@ class ::IshManager::EmailTemplatesController < ::IshManager::ApplicationControll
35
35
  Ish::EmailTemplate.find_by({ slug: params[:id] })
36
36
  authorize! :iframe_src, @email_template
37
37
 
38
- @lead = Lead.find_by({ email: 'poxlovi@gmail.com' })
39
- @ctx = Ctx.new({ email_template: @tmpl, lead_id: @lead.id })
38
+ @lead = Lead.find_by({ email: 'poxlovi@gmail.com' })
39
+ @ctx = Ctx.new({ email_template: @tmpl, lead_id: @lead.id })
40
+ @tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
40
41
 
41
42
  @utm_tracking_str = {
42
43
  'cid' => @ctx.lead_id,
@@ -45,21 +46,11 @@ class ::IshManager::EmailTemplatesController < ::IshManager::ApplicationControll
45
46
  'utm_source' => @ctx.tmpl.slug,
46
47
  }.map { |k, v| "#{k}=#{v}" }.join("&")
47
48
 
48
- to = Ishapi::Engine.routes.url_helpers.email_unsubscribes_url({
49
+ @unsubscribe_url = Ishapi::Engine.routes.url_helpers.email_unsubscribes_url({
49
50
  template_id: @ctx.tmpl.id,
50
51
  lead_id: @lead.id,
51
52
  token: @lead.unsubscribe_token,
52
53
  })
53
- obf = Office::ObfuscatedRedirect.find_or_create_by({ to: to })
54
- @unsubscribe_url = Ishapi::Engine.routes.url_helpers.obf_url( obf.id )
55
-
56
- to = Ishapi::Engine.routes.url_helpers.users_dashboard_url({
57
- lead_id: @lead.id,
58
- })
59
- obf = Office::ObfuscatedRedirect.find_or_create_by({ to: to })
60
- @update_preferences_url = Ishapi::Engine.routes.url_helpers.obf_url( obf.id )
61
-
62
- eval( @ctx.tmpl.config_exe )
63
54
 
64
55
  render layout: false
65
56
  end
@@ -43,7 +43,7 @@ module IshManager
43
43
  # return Ishapi::Engine.routes.url_helpers.obf_url( obf.id )
44
44
  # end
45
45
  def obfuscate link
46
- # puts! link, 'obfuscate helper'
46
+ puts! link, 'obfuscate helper' if DEBUG
47
47
  obf = Office::ObfuscatedRedirect.find_or_create_by({ to: link })
48
48
  return Ishapi::Engine.routes.url_helpers.obf_url( obf.id )
49
49
  end
@@ -2,9 +2,11 @@
2
2
  class IshManager::OfficeMailer < IshManager::ApplicationMailer
3
3
 
4
4
  ## 2023-04-02 _vp_ Continue.
5
+ ## 2023-09-24 _vp_ Continue : )
5
6
  def send_context_email ctx_id
6
- @ctx = Ctx.find ctx_id
7
- @lead = Lead.find @ctx.lead_id
7
+ @ctx = Ctx.find ctx_id
8
+ @lead = Lead.find @ctx.lead_id
9
+ @tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
8
10
 
9
11
  @utm_tracking_str = {
10
12
  'cid' => @ctx.lead_id,
@@ -13,11 +15,9 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
13
15
  'utm_source' => @ctx.tmpl.slug,
14
16
  }.map { |k, v| "#{k}=#{v}" }.join("&")
15
17
 
16
- @domain = Rails.application.config.action_mailer.default_url_options[:host]
17
- @origin = "https://#{Rails.application.config.action_mailer.default_url_options[:host]}"
18
+ # @origin = "https://#{Rails.application.config.action_mailer.default_url_options[:host]}"
18
19
 
19
20
  @unsubscribe_url = Ishapi::Engine.routes.url_helpers.email_unsubscribes_url({
20
- host: 'text-host-3',
21
21
  template_id: @ctx.tmpl.id,
22
22
  lead_id: @lead.id,
23
23
  token: @lead.unsubscribe_token,
@@ -28,13 +28,13 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
28
28
  # renderer.send( :request, { host: 'test-host' } )
29
29
  renderer = IshManager::ApplicationMailer.new
30
30
 
31
-
32
31
  renderer.instance_variable_set( :@ctx, @ctx )
33
32
  renderer.instance_variable_set( :@lead, @ctx.lead )
34
33
  renderer.instance_variable_set( :@utm_tracking_str, @utm_tracking_str )
35
34
  renderer.instance_variable_set( :@unsubscribe_url, @unsubscribe_url )
35
+ renderer.instance_variable_set( :@tmpl_config, @tmpl_config )
36
36
 
37
- eval( @ctx.tmpl.config_exe )
37
+ # eval( @ctx.tmpl.config_exe )
38
38
 
39
39
  if 'plain' == @ctx.tmpl.layout
40
40
  rendered_str = ERB.new( @ctx.body ).result( @ctx.get_binding )
@@ -25,6 +25,7 @@
25
25
  .field
26
26
  %label Next Email Actions
27
27
  .eg rand(1..5).business_days.from_now.to_date + rand(8..16).hours + rand(1..59).minutes
28
+ .eg This is not an interval! But you can do Time.now + 30.seconds
28
29
  %br
29
30
 
30
31
  = f.fields_for :ties do |next_f|
@@ -4,4 +4,5 @@
4
4
  %h2.title
5
5
  Edit email Context
6
6
  = link_to "[view]", email_context_path( @ctx )
7
+ = button_to 'Send', send_immediate_email_context_path(@ctx), form_class: 'inline', :data => { :confirm => 'Are you sure?' }
7
8
  = render 'ish_manager/email_contexts/form', ctx: @ctx, tmpl: @tmpl
@@ -19,7 +19,7 @@
19
19
  .W0
20
20
  = render 'paginate', resource: @ctxs, param_name: :ctxs_page, views_prefix: :ish_manager
21
21
 
22
- %table.bordered
22
+ %table.bordered.data-table
23
23
  %thead
24
24
  %tr
25
25
  %th.actions
@@ -29,11 +29,12 @@
29
29
  %th.template Template
30
30
  %th.send_at Send at
31
31
  %th.sent_at Sent at
32
+ %th.unsubscribed_at Unsubscribed at
32
33
  %tbody
33
34
  - @ctxs.each do |ctx|
34
35
  %tr
35
36
  %td.actions.padded
36
- - if ctx.sent_at
37
+ - if ctx.sent_at || ctx.unsubscribed_at
37
38
  \--
38
39
  - else
39
40
  = link_to '[~]', edit_email_context_path(ctx)
@@ -53,6 +54,8 @@
53
54
  .time= pp_time ctx.send_at
54
55
  %td
55
56
  .datetime.padded= pp_date ctx.sent_at
57
+ %td
58
+ .datetime.padded= pp_date ctx.unsubscribed_at
56
59
 
57
60
 
58
61
  = render 'paginate', resource: @ctxs, param_name: :ctxs_page, views_prefix: :ish_manager
@@ -14,8 +14,8 @@
14
14
  201 W 5th St 11th Floor, Austin, TX 78701<br><br>
15
15
 
16
16
  Want to change how you receive these emails? You can
17
- <%= link_to 'update your preferences', '#' %> or
18
- <%= link_to 'unsubscribe from this list', @unsubscribe_url %>.<br><br>
17
+ <% # link_to( 'update your preferences', obfuscate( user_dashboard_url ) ) + ' or ' %>
18
+ <%= link_to 'unsubscribe from this list', obfuscate( @unsubscribe_url ) %>.<br><br>
19
19
 
20
20
  </td>
21
21
 
@@ -15,7 +15,7 @@
15
15
  .col-md-4
16
16
  .field
17
17
  = f.label "From"
18
- = f.select :from_email, options_for_select(Ish::EmailTemplate.from_email_list, selected: email_template.from_email)
18
+ = f.select :from_email, options_for_select(Ish::EmailTemplate.from_email_list, selected: email_template.from_email), {}, class: 'select2'
19
19
  .field.field-subject
20
20
  = f.label :subject
21
21
  = f.text_field :subject
@@ -43,9 +43,9 @@
43
43
  = f.label :config_json
44
44
  = f.text_area :config_json
45
45
 
46
- .field
47
- = f.label :config_exe
48
- = f.text_area :config_exe
46
+ -# .field
47
+ -# = f.label :config_exe
48
+ -# = f.text_area :config_exe
49
49
 
50
50
  .actions
51
51
  = f.submit 'Save'
@@ -6,13 +6,14 @@
6
6
  = link_to '[+]', new_email_template_path
7
7
 
8
8
  = paginate @templates, :param_name => :templates_page, :views_prefix => 'ish_manager'
9
- .email-templates-index.max-width
10
- %table.bordered
11
- %tr
12
- %th
13
- %th Slug
14
- %th Created
15
- %th Updated
9
+ .email-templates-index.maxwidth
10
+ %table.bordered.data-table
11
+ %thead
12
+ %tr
13
+ %th &nbsp;
14
+ %th Slug
15
+ %th Created
16
+ %th Updated
16
17
 
17
18
  - @templates.each do |tmpl|
18
19
  %tr
@@ -325,11 +325,6 @@
325
325
  text-align: left;
326
326
  }
327
327
 
328
- /*
329
- @tab Preheader
330
- @section Preheader Link
331
- @tip Set the styling for your email's preheader links. Choose a color that helps them stand out from your text.
332
- */
333
328
  #templatePreheader .mcnTextContent a,
334
329
  #templatePreheader .mcnTextContent p a {
335
330
  /*@editable*/
@@ -385,11 +380,6 @@
385
380
  text-align: left;
386
381
  }
387
382
 
388
- /*
389
- @tab Header
390
- @section Header Link
391
- @tip Set the styling for your email's header links. Choose a color that helps them stand out from your text.
392
- */
393
383
  #templateHeader .mcnTextContent a,
394
384
  #templateHeader .mcnTextContent p a {
395
385
  /*@editable*/
@@ -445,11 +435,6 @@
445
435
  text-align: left;
446
436
  }
447
437
 
448
- /*
449
- @tab Body
450
- @section Body Link
451
- @tip Set the styling for your email's body links. Choose a color that helps them stand out from your text.
452
- */
453
438
  #templateBody .mcnTextContent a,
454
439
  #templateBody .mcnTextContent p a {
455
440
  /*@editable*/
@@ -1028,10 +1013,10 @@
1028
1013
 
1029
1014
 
1030
1015
  <a class="mcnButton " title="Read More"
1031
- href='<%= obfuscate "#{@origin}#{@button_path}?#{@utm_tracking_str}" %>'
1016
+ href='<%= obfuscate "#{@tmpl_config[:button_link]}?#{@utm_tracking_str}" %>'
1032
1017
  target="_blank"
1033
- style="font-weight: bold;letter-spacing: -0.5px;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;">Learn
1034
- More</a>
1018
+ style="font-weight: bold;letter-spacing: -0.5px;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;"
1019
+ >Learn More</a>
1035
1020
  </td>
1036
1021
  </tr>
1037
1022
  </tbody>
@@ -10,12 +10,13 @@ namespace :office do
10
10
 
11
11
  sch.send_and_roll
12
12
 
13
- print '+'
13
+ print '.'
14
14
  end
15
15
 
16
- # sleep 1.minute
17
- sleep 10.seconds
18
- print '.'
16
+ duration = Rails.env.production? ? 120 : 15 # 2 minutes or 15 seconds
17
+ sleep duration
18
+ print '^'
19
+
19
20
  end
20
21
  end
21
22
 
@@ -51,25 +52,30 @@ namespace :office do
51
52
  ctxs = ::Ish::EmailContext.scheduled.notsent
52
53
  ctxs.map do |ctx|
53
54
 
54
- unsub = Ish::EmailUnsubscribe.where({ lead_id: ctx.lead_id, template_id: ctx.template_id }).first
55
+ unsub = Ish::EmailUnsubscribe.where({ lead_id: ctx.lead_id, template_id: ctx.email_template_id }).first
55
56
  if unsub
56
- Office::AdminMessage.create({ message: "Lead `#{ctx.lead.full_name}` [mailto:#{ctx.lead.email}] has already unsubscribed from template `#{Ish::EmailTemplate.find( ctx.template_id ).slug}` ." })
57
- email_action_ids = EAction.where({ email_template_id: ctx.template_id }).map(&:id)
57
+ puts! 'This user is unsubscribed; the context cannot be sent.' if DEBUG
58
+ Office::AdminMessage.create({ message: "Lead `#{ctx.lead.full_name}` [mailto:#{ctx.lead.email}] has already unsubscribed from template `#{Ish::EmailTemplate.find( ctx.email_template_id ).slug}` ." })
59
+ email_action_ids = EAct.where({ email_template_id: ctx.email_template_id }).map(&:id)
58
60
  schs = Sch.active.where({
59
61
  lead_id: ctx.lead_id,
60
62
  :email_action_id.in => email_action_ids,
61
63
  })
62
64
  schs.update({ state: Office::ScheduledEmailAction::STATE_UNSUBSCRIBED })
65
+ ctx.update({
66
+ unsubscribed_at: Time.now.to_s,
67
+ })
68
+ else
69
+ out = IshManager::OfficeMailer.send_context_email( ctx[:id].to_s )
70
+ Rails.env.production? ? out.deliver_later : out.deliver_now
63
71
  end
64
72
 
65
- out = IshManager::OfficeMailer.send_context_email( ctx[:id].to_s )
66
- Rails.env.production? ? out.deliver_later : out.deliver_now
67
- print '^'
73
+ print '.'
68
74
  end
69
75
 
70
76
  duration = Rails.env.production? ? 120 : 15 # 2 minutes or 15 seconds
71
77
  sleep duration
72
- print '.'
78
+ print '^'
73
79
 
74
80
  end
75
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.482
4
+ version: 0.1.8.484
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox