wco_models 3.1.0.90 → 3.1.0.92
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 +4 -4
- data/app/controllers/wco/unsubscribes_controller.rb +40 -0
- data/app/mailers/wco_email/application_mailer.rb +15 -14
- data/app/models/wco/lead.rb +28 -0
- data/app/models/wco/leadset.rb +4 -0
- data/app/models/wco_email/context.rb +1 -1
- data/app/models/wco_email/email_template.rb +1 -1
- data/app/models/wco_email/message_stub.rb +4 -11
- data/app/views/wco_email/application_mailer/_footer_unsubscribe.html.erb +24 -0
- data/app/views/wco_email/application_mailer/_header_logo.html.erb +12 -0
- data/app/views/wco_email/email_layouts/_m20221201react.html.erb +1202 -0
- data/app/views/wco_email/email_layouts/_m20221222merryxmas.html.erb +766 -0
- data/app/views/wco_email/email_layouts/_m202309_feedback.html.erb +1161 -0
- data/app/views/wco_email/email_layouts/_m202309_ror4.html.erb +1068 -0
- data/app/views/wco_email/email_layouts/_marketing_node_1.html.erb +984 -0
- data/app/views/wco_email/email_layouts/_marketing_react_1.html +0 -0
- data/app/views/wco_email/email_layouts/_marketing_react_2.html.erb +749 -0
- data/app/views/wco_email/email_layouts/_marketing_react_3.html.erb +628 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_1.html +751 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_2.html.erb +755 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_3.html.erb +25 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_4.html.erb +25 -0
- data/app/views/wco_email/email_layouts/_marketing_ror_5.html.erb +17 -0
- data/app/views/wco_email/email_layouts/_marketing_wordpress_1.html +0 -0
- data/app/views/wco_email/email_layouts/_marketing_wordpress_2.html +0 -0
- data/app/views/wco_email/email_layouts/_piousbox_roundborders.html.erb +1007 -0
- data/app/views/wco_email/email_layouts/_plain.haml +18 -0
- data/app/views/wco_email/email_layouts/_rec_resume_shared_with_you.html.erb +39 -0
- data/app/views/wco_email/email_layouts/_slug-1.html.erb +0 -0
- data/app/views/wco_email/email_layouts/_slug-2.html.erb +0 -0
- data/app/views/wco_email/email_layouts/_slug-3.html.erb +0 -0
- data/app/views/wco_email/email_layouts/_test_tracking_footer.haml +12 -0
- data/app/views/wco_email/email_layouts/_wasyaco_roundborders.html.erb +686 -0
- data/app/views/wco_email/unsubscribes/_header.haml +4 -0
- data/app/views/wco_email/unsubscribes/_table.haml +22 -0
- data/config/routes.rb +2 -0
- metadata +30 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8acb70bd0285b4695c50cab2fa2c2338fa51dacb535df93fcfa805cd58e47f6f
|
|
4
|
+
data.tar.gz: 0c1ce2b3a16a79982db08be8d129eced17acbf36cc246c6b095fbed813f14c43
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: efd8df489b52203a347f640a572433eb71f567de9454ac5de57d2949f08de48836d6dc394dd0bcc9ac025b7303004bb9575080618eebfc02d144f93d1efb871f
|
|
7
|
+
data.tar.gz: 6bf11e6d4cf82022a4db7d1f07e7fb520bbe47d4a9e00c15bf31ecb73c5c7576f3c12a46c808912da35ea24002df622b72ae895028e2d72dc3912f9c790de06f
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class Wco::UnsubscribesController < WcoEmail::ApplicationController
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
authorize! :open_permission, Wco
|
|
7
|
+
@lead = Wco::Lead.find params[:lead_id]
|
|
8
|
+
|
|
9
|
+
if( !params[:token] ||
|
|
10
|
+
@lead.unsubscribe_token != params[:token] )
|
|
11
|
+
render code: 400, message: "We're sorry, but something went wrong. Please try again later."
|
|
12
|
+
return
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
@unsubscribe = WcoEmail::Unsubscribe.find_or_create_by({
|
|
16
|
+
lead_id: params[:lead_id],
|
|
17
|
+
template_id: params[:template_id],
|
|
18
|
+
campaign_id: params[:campaign_id],
|
|
19
|
+
})
|
|
20
|
+
flag = @unsubscribe.update_attributes({
|
|
21
|
+
unsubscribed_at: Time.now,
|
|
22
|
+
})
|
|
23
|
+
if flag
|
|
24
|
+
flash_notice "You have been unsubscribed."
|
|
25
|
+
else
|
|
26
|
+
flash_alert "We're sorry, but something went wrong. Please try again later."
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
render layout: false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def index
|
|
33
|
+
authorize! :index, WcoEmail::Unsubscribe
|
|
34
|
+
@unsubscribes = WcoEmail::Unsubscribe.all
|
|
35
|
+
|
|
36
|
+
render '_table'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
@@ -6,15 +6,6 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
|
|
|
6
6
|
|
|
7
7
|
layout 'mailer'
|
|
8
8
|
|
|
9
|
-
def self.renderer ctx:
|
|
10
|
-
out = self.new
|
|
11
|
-
out.instance_variable_set( :@ctx, ctx )
|
|
12
|
-
out.instance_variable_set( :@lead, ctx.lead )
|
|
13
|
-
out.instance_variable_set( :@utm_tracking_str, ctx.utm_tracking_str )
|
|
14
|
-
out.instance_variable_set( :@unsubscribe_url, ctx.unsubscribe_url )
|
|
15
|
-
out.instance_variable_set( :@config, ctx.config )
|
|
16
|
-
return out
|
|
17
|
-
end
|
|
18
9
|
|
|
19
10
|
def forwarder_notify msg_id
|
|
20
11
|
@msg = WcoEmail::Message.find msg_id
|
|
@@ -53,13 +44,11 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
|
|
|
53
44
|
mail( to: DEFAULT_RECIPIENT, subject: "Test email at #{Time.now}" )
|
|
54
45
|
end
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
## 2023-09-24 _vp_ Continue : )
|
|
58
|
-
## 2024-01-17 _vp_ Continue : )
|
|
47
|
+
|
|
59
48
|
def send_context_email ctx_id
|
|
60
49
|
@ctx = Ctx.find ctx_id
|
|
61
|
-
renderer
|
|
62
|
-
rendered_str = renderer.render_to_string("/wco_email/
|
|
50
|
+
@renderer = self.class.renderer ctx: @ctx
|
|
51
|
+
rendered_str = @renderer.render_to_string("/wco_email/email_layouts/_#{@ctx.tmpl.layout}")
|
|
63
52
|
@ctx.update({
|
|
64
53
|
rendered_str: rendered_str,
|
|
65
54
|
})
|
|
@@ -73,4 +62,16 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
|
|
|
73
62
|
content_type: "text/html" )
|
|
74
63
|
end
|
|
75
64
|
|
|
65
|
+
|
|
66
|
+
def self.renderer ctx:
|
|
67
|
+
out = self.new
|
|
68
|
+
out.instance_variable_set( :@ctx, ctx )
|
|
69
|
+
out.instance_variable_set( :@lead, ctx.lead )
|
|
70
|
+
out.instance_variable_set( :@utm_tracking_str, ctx.utm_tracking_str )
|
|
71
|
+
out.instance_variable_set( :@unsubscribe_url, ctx.unsubscribe_url )
|
|
72
|
+
out.instance_variable_set( :@config, ctx.config )
|
|
73
|
+
out.instance_variable_set( :@renderer, out )
|
|
74
|
+
return out
|
|
75
|
+
end
|
|
76
|
+
|
|
76
77
|
end
|
data/app/models/wco/lead.rb
CHANGED
|
@@ -19,6 +19,34 @@ class Wco::Lead
|
|
|
19
19
|
domain = email.split('@')[1]
|
|
20
20
|
self.leadset ||= Wco::Leadset.find_or_create_by({ company_url: domain })
|
|
21
21
|
end
|
|
22
|
+
before_validation :normalize_email, on: :create
|
|
23
|
+
def normalize_email
|
|
24
|
+
self[:email] = email.downcase
|
|
25
|
+
if email.index('+')
|
|
26
|
+
a = email
|
|
27
|
+
a.slice!( a[a.index('+')...a.index('@')] )
|
|
28
|
+
self[:email] = a
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
def self.normalize_email a
|
|
32
|
+
a = a.downcase
|
|
33
|
+
if a.index('+')
|
|
34
|
+
a.slice!( a[a.index('+')...a.index('@')] )
|
|
35
|
+
end
|
|
36
|
+
return a
|
|
37
|
+
end
|
|
38
|
+
def self.find_or_create_by_email email
|
|
39
|
+
email = self.normalize_email email
|
|
40
|
+
out = where( email: email ).first
|
|
41
|
+
if !out
|
|
42
|
+
domain = email.split('@')[1]
|
|
43
|
+
leadset = Wco::Leadset.where( company_url: domain ).first
|
|
44
|
+
leadset ||= Wco::Leadset.create( company_url: domain, email: email )
|
|
45
|
+
out = create!( email: email, leadset: leadset )
|
|
46
|
+
end
|
|
47
|
+
return out
|
|
48
|
+
end
|
|
49
|
+
|
|
22
50
|
|
|
23
51
|
has_one :photo, class_name: 'Wco::Photo'
|
|
24
52
|
|
data/app/models/wco/leadset.rb
CHANGED
|
@@ -8,6 +8,10 @@ class Wco::Leadset
|
|
|
8
8
|
field :company_url
|
|
9
9
|
validates :company_url, presence: true, uniqueness: true
|
|
10
10
|
index({ company_url: 1 }, { unique: true, name: 'company_url' })
|
|
11
|
+
before_validation :normalize_company_url, on: :create
|
|
12
|
+
def normalize_company_url
|
|
13
|
+
company_url.downcase!
|
|
14
|
+
end
|
|
11
15
|
|
|
12
16
|
field :email
|
|
13
17
|
index({ email: 1 }, { name: 'email' })
|
|
@@ -123,7 +123,7 @@ class WcoEmail::Context
|
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
def unsubscribe_url
|
|
126
|
-
|
|
126
|
+
Wco::Engine.routes.url_helpers.unsubscribes_url({
|
|
127
127
|
host: Rails.application.routes.default_url_options[:host],
|
|
128
128
|
lead_id: lead_id,
|
|
129
129
|
template_id: tmpl.id,
|
|
@@ -86,17 +86,13 @@ class WcoEmail::MessageStub
|
|
|
86
86
|
|
|
87
87
|
## Leadset, Lead
|
|
88
88
|
from = the_mail.from ? the_mail.from[0] : "nobody@unknown-doma.in"
|
|
89
|
-
|
|
90
|
-
leadset = Wco::Leadset.where( company_url: domain ).first
|
|
91
|
-
leadset ||= Wco::Leadset.create( company_url: domain, email: from )
|
|
92
|
-
lead = Wco::Lead.find_or_create_by( email: from, leadset: leadset )
|
|
93
|
-
|
|
89
|
+
lead = Wco::Lead.find_or_create_by_email( from )
|
|
94
90
|
|
|
95
91
|
message = WcoEmail::Message.unscoped.where( message_id: message_id ).first
|
|
96
92
|
if message
|
|
97
93
|
message.message_id = "#{Time.now.strftime('%Y%m%d')}-trash-#{message.message_id}"
|
|
98
94
|
message.object_key = "#{Time.now.strftime('%Y%m%d')}-trash-#{message.object_key}"
|
|
99
|
-
message.save
|
|
95
|
+
message.save( validate: false )
|
|
100
96
|
message.delete
|
|
101
97
|
end
|
|
102
98
|
|
|
@@ -119,7 +115,7 @@ class WcoEmail::MessageStub
|
|
|
119
115
|
tos: the_mail.to,
|
|
120
116
|
|
|
121
117
|
cc: the_mail.cc ? the_mail.cc[0] : nil,
|
|
122
|
-
ccs:
|
|
118
|
+
ccs: the_mail.cc,
|
|
123
119
|
})
|
|
124
120
|
puts! @message, '@message'
|
|
125
121
|
|
|
@@ -152,14 +148,11 @@ class WcoEmail::MessageStub
|
|
|
152
148
|
puts! @message.errors.full_messages.join(", "), "Could not save @message"
|
|
153
149
|
end
|
|
154
150
|
|
|
155
|
-
|
|
156
151
|
conv.leads.push lead
|
|
157
152
|
conv.save
|
|
158
153
|
|
|
159
154
|
the_mail.cc&.each do |cc|
|
|
160
|
-
|
|
161
|
-
leadset = Wco::Leadset.find_or_create_by( company_url: domain )
|
|
162
|
-
Wco::Lead.find_or_create_by( email: cc, leadset: leadset )
|
|
155
|
+
Wco::Lead.find_or_create_by_email( cc )
|
|
163
156
|
end
|
|
164
157
|
|
|
165
158
|
conv.update_attributes({
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<table align="left" border="0" cellpadding="0" cellspacing="0"
|
|
2
|
+
style="max-width:100%; min-width:100%;" width="100%"
|
|
3
|
+
class="mcnTextContentContainer">
|
|
4
|
+
<tbody>
|
|
5
|
+
<tr>
|
|
6
|
+
|
|
7
|
+
<td valign="top" class="mcnTextContent"
|
|
8
|
+
style="padding-top:0; padding-right:160px; padding-bottom:9px; padding-left:160px;">
|
|
9
|
+
|
|
10
|
+
<em>Copyright © Wasya Co</em><br><br>
|
|
11
|
+
|
|
12
|
+
<strong>Our mailing address is:</strong><br>
|
|
13
|
+
|
|
14
|
+
201 W 5th St 11th Floor, Austin, TX 78701<br><br>
|
|
15
|
+
|
|
16
|
+
Want to change how you receive these emails? You can
|
|
17
|
+
<% # link_to( 'update your preferences', obfuscate( user_dashboard_url ) ) + ' or ' %>
|
|
18
|
+
<%= link_to 'unsubscribe from this list', obfuscate( @unsubscribe_url ) %>.<br><br>
|
|
19
|
+
|
|
20
|
+
</td>
|
|
21
|
+
|
|
22
|
+
</tr>
|
|
23
|
+
</tbody>
|
|
24
|
+
</table>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
<table cellpadding="0" cellspacing="0" width="100%">
|
|
3
|
+
<tr>
|
|
4
|
+
<td align="center">
|
|
5
|
+
<br />
|
|
6
|
+
<img
|
|
7
|
+
src="https://d15g8hc4183yn4.cloudfront.net/wp-content/uploads/2022/09/29185755/259x66-WasyaCo-Logo-YellowShadow.png"
|
|
8
|
+
alt="Wasya Co [logo]" />
|
|
9
|
+
</td>
|
|
10
|
+
</tr>
|
|
11
|
+
</table>
|
|
12
|
+
<br /><br />
|