ish_models 0.0.33.270 → 0.0.33.271

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: 1c695f34fb6f38b0daca48bda88a508f027db99f726989a9418d975b5026541a
4
+ data.tar.gz: 34fed5affbb1c25f15d4940fe1766cd51d4ab7f26fc73de646ddf0426035f1d0
5
5
  SHA512:
6
- metadata.gz: 6c19cf76354a8913e5427928a76d3b7bbc5bd288d13964d76753e3bf1836909d376666ea9c7ad66a1ee4b2bd3133e17bef4cc74dea1556b6711de495e56f0397
7
- data.tar.gz: add6b003c34a83b1f0ef27248c7f0645506dd378f7d9daf3a2883fdb949a4aa6c6dd985f8ceaa4413090b91284d0160bfd3e7fa7c827807d2cab2e18ffb03b1e
6
+ metadata.gz: 0d93535ede083430aa2ee86109548a3f8af463021fb95078b5864347431a9bd6ebb73cbd39ff69bb16cdacb8f992f218baa4cdba53e4c844feb9f25e45dfd87c
7
+ data.tar.gz: a7c61121c5741d2232a5dda85ae16793d317b3aed5fe808f9b025d9d13a611c0f49579b1d581a3001fa969b8ca6b94958fad24ad3ff0de84af51f47a41730078
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
@@ -34,6 +34,8 @@ class Ish::EmailCampaign
34
34
  field :sent_at, type: DateTime
35
35
  field :send_at, type: DateTime
36
36
 
37
+ has_many :unsubscribes, class_name: '::Ish::EmailUnsubscribe', inverse_of: :campaign
38
+
37
39
  def campaign_leads
38
40
  return ::EmailCampaignLead.where( email_campaign_id: self.id.to_s ).includes( :lead )
39
41
  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
@@ -12,6 +12,7 @@ class ::Ish::EmailTemplate
12
12
  field :layout, type: :string, default: 'plain'
13
13
  LAYOUTS = %w| plain
14
14
  m20221201react m20221222merryxmas
15
+ m202309_feedback
15
16
  marketing_node_1
16
17
  marketing_react_1 marketing_react_2 marketing_react_3
17
18
  marketing_ror_1 marketing_ror_2
@@ -23,6 +24,8 @@ class ::Ish::EmailTemplate
23
24
 
24
25
  field :subject
25
26
  field :body
27
+ field :can_unsubscribe, type: :boolean, default: true
28
+ field :config_exe, default: ""
26
29
 
27
30
  FROM_EMAILS = [
28
31
  'Annesque Studio <hello@annesque.studio>',
@@ -75,7 +78,8 @@ class ::Ish::EmailTemplate
75
78
 
76
79
  has_many :email_actions, class_name: '::Office::EmailAction'
77
80
  has_many :email_contexts, class_name: '::Ish::EmailContext'
78
- has_many :email_filters, class_name: '::Office::EmailFilter', inverse_of: :email_template
81
+ has_many :email_filters, class_name: '::Office::EmailFilter', inverse_of: :email_template
82
+ has_many :unsubscribes, class_name: '::Ish::EmailUnsubscribe', inverse_of: :template
79
83
 
80
84
  SLUG_BLANK = 'blank'
81
85
  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'
@@ -72,6 +71,9 @@ require 'office/email_conversation'
72
71
  require 'office/email_filter'
73
72
  require 'office/email_message'
74
73
  require 'office/email_message_stub'
74
+ require 'office/lead_action'
75
+ require 'office/lead_action_template'
76
+ require 'office/obfuscated_redirect'
75
77
  require 'office/scheduled_email_action'
76
78
 
77
79
  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
+
@@ -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
 
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.271
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,7 +171,6 @@ 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
178
176
  - lib/office/email_action.rb
@@ -181,6 +179,9 @@ files:
181
179
  - lib/office/email_filter.rb
182
180
  - lib/office/email_message.rb
183
181
  - lib/office/email_message_stub.rb
182
+ - lib/office/lead_action.rb
183
+ - lib/office/lead_action_template.rb
184
+ - lib/office/obfuscated_redirect.rb
184
185
  - lib/office/scheduled_email_action.rb
185
186
  - lib/photo.rb
186
187
  - 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
-