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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d127d11648710572a0ccfd485e9b83c6c9f86d751c5d017ddc0cc49318276a4
4
- data.tar.gz: ef1bec175600344e71e4fc7965f35e3a5ffd053e0f046f20676a2983c79a8d6f
3
+ metadata.gz: 569fd681a6098f88e39d36996bc031e4094d57d4250efdf5d76961857b8b5987
4
+ data.tar.gz: 5737743c665eb8998829713413e0f5c70273596c0d749c6ab2a1ef366498fa1d
5
5
  SHA512:
6
- metadata.gz: 6c19cf76354a8913e5427928a76d3b7bbc5bd288d13964d76753e3bf1836909d376666ea9c7ad66a1ee4b2bd3133e17bef4cc74dea1556b6711de495e56f0397
7
- data.tar.gz: add6b003c34a83b1f0ef27248c7f0645506dd378f7d9daf3a2883fdb949a4aa6c6dd985f8ceaa4413090b91284d0160bfd3e7fa7c827807d2cab2e18ffb03b1e
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, type: Boolean, default: false
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
- default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
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
@@ -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
@@ -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
 
@@ -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', inverse_of: :email_template
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,11 @@
1
+
2
+
3
+ class Office::AdminMessage
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+
7
+ field :message
8
+
9
+ end
10
+
11
+
@@ -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
+
@@ -0,0 +1,12 @@
1
+
2
+ class Office::ObfuscatedRedirect
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ field :to, type: :string
7
+ validates :to, presence: true
8
+
9
+ field :visited_at, type: DateTime
10
+ field :visits, type: :array, default: []
11
+
12
+ end
@@ -13,10 +13,11 @@ class Office::ScheduledEmailAction
13
13
  Lead.find( lead_id )
14
14
  end
15
15
 
16
- STATE_ACTIVE = 'active'
17
- STATE_INACTIVE = 'inactive'
18
- STATE_TRASH = 'trash'
19
- STATES = [ STATE_ACTIVE, STATE_INACTIVE, STATE_TRASH ]
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.update_attributes({ state: Sch::STATE_INACTIVE })
36
+ sch.update({ state: Sch::STATE_INACTIVE })
36
37
 
37
38
  # send now
38
39
  ctx = Ctx.create!({
39
- email_template_id: sch.act.tmpl.id,
40
- lead_id: sch.lead.id,
41
- send_at: Time.now,
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: sch.lead_id,
53
- email_action_id: next_act.id,
51
+ lead_id: sch.lead_id,
52
+ email_action_id: tie.next_email_action.id,
54
53
  })
55
- next_sch.perform_at = next_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
@@ -29,6 +29,9 @@ class Video
29
29
  end
30
30
 
31
31
  field :is_public, :type => Boolean, :default => false
32
+ def public
33
+ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc })
34
+ end
32
35
 
33
36
  field :lead_id, type: :integer
34
37
 
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.270
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
@@ -1,10 +0,0 @@
1
-
2
- # @TODO: completely rework this
3
- module Ish
4
- class GalleryName
5
- include Mongoid::Document
6
- include Mongoid::Timestamps
7
- field :text
8
- embedded_in :gallery
9
- end
10
- end
@@ -1,11 +0,0 @@
1
-
2
-
3
-
4
- field :username
5
- field :partial_name
6
- field :is_feature, :type => Boolean, :default => false
7
-
8
-
9
-
10
- PER_PAGE = 6
11
-