ish_models 0.0.33.270 → 0.0.33.272
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gallery.rb +4 -2
- data/lib/ish/email_campaign.rb +2 -9
- data/lib/ish/email_context.rb +1 -5
- data/lib/ish/email_template.rb +9 -1
- data/lib/ish/email_unsubscribe.rb +5 -5
- data/lib/ish_models.rb +4 -1
- data/lib/newsitem.rb +1 -1
- data/lib/office/admin_message.rb +11 -0
- data/lib/office/lead_action.rb +21 -0
- data/lib/office/lead_action_template.rb +40 -0
- data/lib/office/obfuscated_redirect.rb +12 -0
- data/lib/office/scheduled_email_action.rb +14 -15
- data/lib/video.rb +3 -0
- metadata +5 -3
- data/lib/ish/gallery_name.rb +0 -10
- data/lib/newsitem.rb-trash +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 569fd681a6098f88e39d36996bc031e4094d57d4250efdf5d76961857b8b5987
|
4
|
+
data.tar.gz: 5737743c665eb8998829713413e0f5c70273596c0d749c6ab2a1ef366498fa1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c97854130e7399943406ac285198bbd101d4d3f06a9daa478f6266079b70efc4f62e287e1b1660f51c7187f41241b1b8c62cae8b4a5a6e8eb061d65ebb0030f
|
7
|
+
data.tar.gz: 8912dcb2e23c9da38481c5af234b66bfdab701ffc4ca016f3747b5ff81e0c59bb63c307c4fab62c145dcdfe74ad7b78f2d49daac301098c7216796060a81830e
|
data/lib/gallery.rb
CHANGED
@@ -14,13 +14,15 @@ class Gallery
|
|
14
14
|
field :subhead
|
15
15
|
field :descr, :as => :description
|
16
16
|
|
17
|
-
field :is_public,
|
17
|
+
field :is_public, type: Boolean, default: false
|
18
18
|
has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_galleries
|
19
19
|
|
20
20
|
field :is_trash, type: Boolean, default: false
|
21
21
|
field :is_done, type: Boolean, default: false
|
22
22
|
|
23
|
-
|
23
|
+
def public
|
24
|
+
where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc })
|
25
|
+
end
|
24
26
|
|
25
27
|
field :x, :type => Float
|
26
28
|
field :y, :type => Float
|
data/lib/ish/email_campaign.rb
CHANGED
@@ -15,15 +15,6 @@ class Ish::EmailCampaign
|
|
15
15
|
|
16
16
|
field :from_email
|
17
17
|
validates_presence_of :from_email
|
18
|
-
FROM_EMAILS = %w| hello@infiniteshelter.com no-reply@infiniteshelter.com
|
19
|
-
piousbox@gmail.com
|
20
|
-
hello@piousbox.com no-reply@piousbox.com victor@piousbox.com
|
21
|
-
admin@wasya.co hello@wasya.co no-reply@wasya.co victor@wasya.co
|
22
|
-
admin@mail.wasyaco.com hello@mail.wasyaco.com no-reply@mail.wasyaco.com victor@mail.wasyaco.com
|
23
|
-
|;
|
24
|
-
def self.from_email_list
|
25
|
-
[ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
|
26
|
-
end
|
27
18
|
|
28
19
|
belongs_to :email_template
|
29
20
|
def tmpl; email_template; end
|
@@ -34,6 +25,8 @@ class Ish::EmailCampaign
|
|
34
25
|
field :sent_at, type: DateTime
|
35
26
|
field :send_at, type: DateTime
|
36
27
|
|
28
|
+
has_many :unsubscribes, class_name: '::Ish::EmailUnsubscribe', inverse_of: :campaign
|
29
|
+
|
37
30
|
def campaign_leads
|
38
31
|
return ::EmailCampaignLead.where( email_campaign_id: self.id.to_s ).includes( :lead )
|
39
32
|
end
|
data/lib/ish/email_context.rb
CHANGED
@@ -37,7 +37,6 @@ class ::Ish::EmailContext
|
|
37
37
|
return tmpl.from_email
|
38
38
|
end
|
39
39
|
end
|
40
|
-
# validates_presence_of :from_email
|
41
40
|
|
42
41
|
field :subject
|
43
42
|
def subject
|
@@ -71,10 +70,6 @@ class ::Ish::EmailContext
|
|
71
70
|
def self.scheduled; new.scheduled; end
|
72
71
|
|
73
72
|
|
74
|
-
def self.from_email_list
|
75
|
-
Ish::EmailCampaign.from_email_list
|
76
|
-
end
|
77
|
-
|
78
73
|
## like belongs_to to_lead , but Lead is SQL to just the lead_id
|
79
74
|
field :lead_id, type: :integer
|
80
75
|
def lead; Lead.find( lead_id ); end
|
@@ -94,6 +89,7 @@ class ::Ish::EmailContext
|
|
94
89
|
'utm_medium' => 'email',
|
95
90
|
'utm_source' => tmpl.slug,
|
96
91
|
}.map { |k, v| "#{k}=#{v}" }.join("&")
|
92
|
+
eval( tmpl.config_exe )
|
97
93
|
binding()
|
98
94
|
end
|
99
95
|
|
data/lib/ish/email_template.rb
CHANGED
@@ -12,6 +12,8 @@ class ::Ish::EmailTemplate
|
|
12
12
|
field :layout, type: :string, default: 'plain'
|
13
13
|
LAYOUTS = %w| plain
|
14
14
|
m20221201react m20221222merryxmas
|
15
|
+
m202309_feedback
|
16
|
+
m202309_ror4
|
15
17
|
marketing_node_1
|
16
18
|
marketing_react_1 marketing_react_2 marketing_react_3
|
17
19
|
marketing_ror_1 marketing_ror_2
|
@@ -23,6 +25,9 @@ class ::Ish::EmailTemplate
|
|
23
25
|
|
24
26
|
field :subject
|
25
27
|
field :body
|
28
|
+
field :can_unsubscribe, type: :boolean, default: true
|
29
|
+
field :config_exe, default: "" ## used a lot.
|
30
|
+
field :config_json, type: Object, default: '{}'
|
26
31
|
|
27
32
|
FROM_EMAILS = [
|
28
33
|
'Annesque Studio <hello@annesque.studio>',
|
@@ -61,6 +66,8 @@ class ::Ish::EmailTemplate
|
|
61
66
|
'WasyaCo Consulting <hello@wasyaco.com>',
|
62
67
|
'WasyaCo Consulting <no-reply@wasyaco.com>',
|
63
68
|
'Victor <victor@wasyaco.com>',
|
69
|
+
|
70
|
+
'Wasya Co Mailer <no-reply@wco.com.de>',
|
64
71
|
];
|
65
72
|
field :from_email
|
66
73
|
def self.from_email_list
|
@@ -75,7 +82,8 @@ class ::Ish::EmailTemplate
|
|
75
82
|
|
76
83
|
has_many :email_actions, class_name: '::Office::EmailAction'
|
77
84
|
has_many :email_contexts, class_name: '::Ish::EmailContext'
|
78
|
-
has_many :email_filters, class_name: '::Office::EmailFilter',
|
85
|
+
has_many :email_filters, class_name: '::Office::EmailFilter', inverse_of: :email_template
|
86
|
+
has_many :unsubscribes, class_name: '::Ish::EmailUnsubscribe', inverse_of: :template
|
79
87
|
|
80
88
|
SLUG_BLANK = 'blank'
|
81
89
|
def self.blank_template
|
@@ -4,15 +4,15 @@ class Ish::EmailUnsubscribe
|
|
4
4
|
include Mongoid::Timestamps
|
5
5
|
|
6
6
|
field :email
|
7
|
-
validates_presence_of :email
|
8
|
-
validates_uniqueness_of :email
|
9
|
-
|
10
|
-
field :mailer_type
|
7
|
+
# validates_presence_of :email
|
8
|
+
# validates_uniqueness_of :email
|
11
9
|
|
10
|
+
field :lead_id
|
12
11
|
field :reason
|
13
|
-
|
14
12
|
field :unsubscribed_at
|
15
13
|
|
14
|
+
belongs_to :campaign, class_name: '::Ish::EmailCampaign', inverse_of: :unsubscribes
|
15
|
+
belongs_to :template, class_name: '::Ish::EmailTemplate', inverse_of: :unsubscribes
|
16
16
|
|
17
17
|
|
18
18
|
end
|
data/lib/ish_models.rb
CHANGED
@@ -49,7 +49,6 @@ require 'ish/email_context'
|
|
49
49
|
require 'ish/email_template'
|
50
50
|
require 'ish/email_unsubscribe'
|
51
51
|
require 'ish/event'
|
52
|
-
require 'ish/gallery_name'
|
53
52
|
require 'ish/image_asset'
|
54
53
|
require 'ish/invoice'
|
55
54
|
require 'ish/lorem_ipsum'
|
@@ -66,12 +65,16 @@ require 'video'
|
|
66
65
|
|
67
66
|
require 'office/action'
|
68
67
|
require 'office/action_tie'
|
68
|
+
require 'office/admin_message'
|
69
69
|
require 'office/email_action'
|
70
70
|
require 'office/email_action_tie'
|
71
71
|
require 'office/email_conversation'
|
72
72
|
require 'office/email_filter'
|
73
73
|
require 'office/email_message'
|
74
74
|
require 'office/email_message_stub'
|
75
|
+
require 'office/lead_action'
|
76
|
+
require 'office/lead_action_template'
|
77
|
+
require 'office/obfuscated_redirect'
|
75
78
|
require 'office/scheduled_email_action'
|
76
79
|
|
77
80
|
require 'wco/appliance'
|
data/lib/newsitem.rb
CHANGED
@@ -16,7 +16,7 @@ class Newsitem
|
|
16
16
|
self.gallery_id ? Gallery.unscoped.find( self.gallery_id ) : nil
|
17
17
|
end
|
18
18
|
belongs_to :map, optional: true, class_name: '::Gameui::Map'
|
19
|
-
belongs_to :profile, optional: true, class_name: 'Ish::UserProfile'
|
19
|
+
belongs_to :profile, optional: true, class_name: '::Ish::UserProfile'
|
20
20
|
belongs_to :photo, optional: true
|
21
21
|
belongs_to :report, optional: true
|
22
22
|
belongs_to :video, optional: true
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
##
|
3
|
+
## The obfuscated action
|
4
|
+
##
|
5
|
+
class Office::LeadAction
|
6
|
+
include Mongoid::Document
|
7
|
+
include Mongoid::Timestamps
|
8
|
+
|
9
|
+
belongs_to :lead_action_template, class_name: '::Office::LeadActionTemplate', inverse_of: :lead_actions, foreign_key: :tmpl_id
|
10
|
+
|
11
|
+
field :lead_id, type: :integer
|
12
|
+
validates :lead_id, presence: true
|
13
|
+
def lead
|
14
|
+
Lead.find( lead_id )
|
15
|
+
end
|
16
|
+
|
17
|
+
field :params, type: Object
|
18
|
+
|
19
|
+
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
##
|
3
|
+
##
|
4
|
+
class Office::LeadActionTemplate
|
5
|
+
include Mongoid::Document
|
6
|
+
include Mongoid::Timestamps
|
7
|
+
|
8
|
+
has_many :lead_actions, class_name: '::Office::LeadAction', inverse_of: :lead_action_templates
|
9
|
+
|
10
|
+
field :slug
|
11
|
+
validates :slug, presence: true
|
12
|
+
|
13
|
+
field :action_exe, type: :string
|
14
|
+
# validates :action_exe, presence: true
|
15
|
+
|
16
|
+
field :config_json, type: Object, default: '{}'
|
17
|
+
|
18
|
+
field :kind, type: :string
|
19
|
+
KIND_UNSUBSCRIBE_TEMPLATE = 'kind-unsubscribe-template'
|
20
|
+
KIND_UNSUBSCRIBE_CAMPAIGN = 'kind-unsubscribe-campaign'
|
21
|
+
KINDS = [ KIND_UNSUBSCRIBE_TEMPLATE, KIND_UNSUBSCRIBE_CAMPAIGN ]
|
22
|
+
|
23
|
+
|
24
|
+
def unsubscribe_from_campaign
|
25
|
+
end
|
26
|
+
|
27
|
+
def unsubscribe_from_template
|
28
|
+
template = EmailTemplate.find( ctx[:template_id] )
|
29
|
+
subject = "Lead #{lead.full_name} unsubscribed from template #{template.slug}"
|
30
|
+
out = Mailer.notify( 'poxlovi@gmail.com', subject )
|
31
|
+
Rails.env.production? ? out.deliver_later : out.deliver_now
|
32
|
+
Office::Unsubscribe.create({
|
33
|
+
lead_id: lead_id,
|
34
|
+
template_id: config_json['template_id'],
|
35
|
+
})
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
end
|
40
|
+
|
@@ -13,10 +13,11 @@ class Office::ScheduledEmailAction
|
|
13
13
|
Lead.find( lead_id )
|
14
14
|
end
|
15
15
|
|
16
|
-
STATE_ACTIVE
|
17
|
-
STATE_INACTIVE
|
18
|
-
STATE_TRASH
|
19
|
-
|
16
|
+
STATE_ACTIVE = 'active'
|
17
|
+
STATE_INACTIVE = 'inactive'
|
18
|
+
STATE_TRASH = 'trash'
|
19
|
+
STATE_UNSUBSCRIBED = 'unsubscribed'
|
20
|
+
STATES = [ STATE_ACTIVE, STATE_INACTIVE, STATE_UNSUBSCRIBED, STATE_TRASH ]
|
20
21
|
field :state, type: :string
|
21
22
|
scope :active, ->{ where( state: STATE_ACTIVE ) }
|
22
23
|
|
@@ -32,27 +33,25 @@ class Office::ScheduledEmailAction
|
|
32
33
|
|
33
34
|
def send_and_roll
|
34
35
|
sch = self
|
35
|
-
sch.
|
36
|
+
sch.update({ state: Sch::STATE_INACTIVE })
|
36
37
|
|
37
38
|
# send now
|
38
39
|
ctx = Ctx.create!({
|
39
|
-
email_template_id:
|
40
|
-
|
41
|
-
|
42
|
-
subject: sch.act.tmpl.subject,
|
43
|
-
from_email: sch.act.tmpl.from_email,
|
40
|
+
email_template_id: sch.act.tmpl.id,
|
41
|
+
from_email: sch.act.tmpl.from_email,
|
42
|
+
lead_id: sch.lead.id,
|
44
43
|
scheduled_email_action_id: sch.act.id,
|
44
|
+
send_at: Time.now,
|
45
|
+
subject: sch.act.tmpl.subject,
|
45
46
|
})
|
46
47
|
|
47
48
|
# schedule next actions & update the action
|
48
49
|
sch.act.ties.each do |tie|
|
49
|
-
next_act = tie.next_email_action
|
50
|
-
next_at = eval(tie.next_at_exe)
|
51
50
|
next_sch = Sch.find_or_initialize_by({
|
52
|
-
lead_id:
|
53
|
-
email_action_id:
|
51
|
+
lead_id: sch.lead_id,
|
52
|
+
email_action_id: tie.next_email_action.id,
|
54
53
|
})
|
55
|
-
next_sch.perform_at =
|
54
|
+
next_sch.perform_at = eval(tie.next_at_exe)
|
56
55
|
next_sch.state = Sch::STATE_ACTIVE
|
57
56
|
next_sch.save!
|
58
57
|
end
|
data/lib/video.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ish_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.33.
|
4
|
+
version: 0.0.33.272
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -158,7 +158,6 @@ files:
|
|
158
158
|
- lib/ish/email_template.rb
|
159
159
|
- lib/ish/email_unsubscribe.rb
|
160
160
|
- lib/ish/event.rb
|
161
|
-
- lib/ish/gallery_name.rb
|
162
161
|
- lib/ish/image_asset.rb
|
163
162
|
- lib/ish/invoice.rb
|
164
163
|
- lib/ish/lorem_ipsum.rb
|
@@ -172,15 +171,18 @@ files:
|
|
172
171
|
- lib/mongoid/votable.rb
|
173
172
|
- lib/mongoid/voter.rb
|
174
173
|
- lib/newsitem.rb
|
175
|
-
- lib/newsitem.rb-trash
|
176
174
|
- lib/office/action.rb
|
177
175
|
- lib/office/action_tie.rb
|
176
|
+
- lib/office/admin_message.rb
|
178
177
|
- lib/office/email_action.rb
|
179
178
|
- lib/office/email_action_tie.rb
|
180
179
|
- lib/office/email_conversation.rb
|
181
180
|
- lib/office/email_filter.rb
|
182
181
|
- lib/office/email_message.rb
|
183
182
|
- lib/office/email_message_stub.rb
|
183
|
+
- lib/office/lead_action.rb
|
184
|
+
- lib/office/lead_action_template.rb
|
185
|
+
- lib/office/obfuscated_redirect.rb
|
184
186
|
- lib/office/scheduled_email_action.rb
|
185
187
|
- lib/photo.rb
|
186
188
|
- lib/report.rb
|
data/lib/ish/gallery_name.rb
DELETED