wco_models 3.1.0.57 → 3.1.0.59

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: 02ffeff264feb085915299e13b7aaf1d824ac2a233e0447c655e994adb73b833
4
- data.tar.gz: 7e395565ac7f589dc2a7fa85a4e3ae0ca8bdd09f8b72eba0d56ae68ba0c4c0da
3
+ metadata.gz: 2b11007f01745aba3d77e2ba586b7989ec42ac5554aa9f53684098cd6f0fd4a1
4
+ data.tar.gz: 835baafdae5711debc5e503730f4fda22e342ecec976e3543fbd9d4ab0cc8a62
5
5
  SHA512:
6
- metadata.gz: c0c820895de72de5f9fab46beffc6347e5ea309d6b33f5c1afb8c231f6763bb43571357757e6b84b0b9b43e1e03a71a079ed4e4a75bed77ea75670a1f083edf9
7
- data.tar.gz: f6b10c5c1b1709ce7d38f68a1782c390ca7f6b31b6eb2497ea669de6d2557a9db30f7588c17f878e5480ef0582c785044495c365a575b1af55f7decb905231ef
6
+ metadata.gz: 1432d0dbfe12b637baee8916c5b1d38f5ebd187678ea3d83ce06527ed304b623051b404602868383feff6897861e15821178199a24f0271d27fbd145075705ed
7
+ data.tar.gz: f43b68d4282382af6bacd3ec26ee511e8d29b1c49e02df4648daa65e8ce0d3df02d412ee9e4a9ec461770c5402c69936a8be4961296322a6690bf2534bee1a16
@@ -11,7 +11,7 @@
11
11
 
12
12
  .select2 {
13
13
  min-width: 200px;
14
- width: 100%;
14
+ /* width: 100%; */
15
15
  }
16
16
 
17
17
  .wco--alerts-notices {
@@ -89,9 +89,15 @@ textarea.monospace {
89
89
 
90
90
  /* F */
91
91
 
92
+
92
93
  .flex-row {
93
94
  display: flex;
94
95
  }
96
+ .flexwidth {
97
+ max-width: 1000px;
98
+ margin: auto;
99
+ }
100
+
95
101
  .field_with_errors {
96
102
  flex-grow: 1;
97
103
  }
@@ -120,7 +126,7 @@ h5.title {
120
126
  /* M */
121
127
 
122
128
  .maxwidth {
123
- max-width: 1000px;
129
+ width: 1000px;
124
130
  margin: auto;
125
131
  }
126
132
 
@@ -0,0 +1,98 @@
1
+
2
+ class WcoEmail::ApplicationMailer < ActionMailer::Base
3
+
4
+ default from: 'WasyaCo Consulting <no-reply@wco.com.de>'
5
+ helper(Wco::ApplicationHelper)
6
+
7
+ layout 'mailer'
8
+
9
+
10
+ def forwarder_notify msg_id
11
+ @msg = WcoEmail::Message.find msg_id
12
+ mail( to: "poxlovi@gmail.com",
13
+ subject: "POX::#{@msg.subject}" )
14
+ end
15
+
16
+ def shared_galleries profiles, gallery
17
+ return if profiles.count == 0
18
+ @gallery = gallery
19
+ @domain = Rails.application.config.action_mailer.default_url_options[:host]
20
+ @galleries_path = IshManager::Engine.routes.url_helpers.galleries_path
21
+ @gallery_path = IshManager::Engine.routes.url_helpers.gallery_path(@gallery.slug)
22
+ mail( :to => '314658@gmail.com',
23
+ :bcc => profiles.map { |p| p.email },
24
+ :subject => 'You got new shared galleries on pi manager' )
25
+ end
26
+
27
+ def option_alert option
28
+ @option = option
29
+ mail({
30
+ :to => option.profile.email,
31
+ :subject => "IshManager Option Alert :: #{option.ticker}",
32
+ })
33
+ end
34
+
35
+ def stock_alert watch_id
36
+ @watch = Iro::OptionWatch.find watch_id
37
+ mail({
38
+ to: @watch.profile.email,
39
+ subject: "Iro Watch Alert :: #{@watch.ticker} is #{@watch.direction} #{@watch.mark}."
40
+ })
41
+ end
42
+
43
+ def test_email
44
+ mail( to: DEFAULT_RECIPIENT, subject: "Test email at #{Time.now}" )
45
+ end
46
+
47
+ ## 2023-04-02 _vp_ Continue.
48
+ ## 2023-09-24 _vp_ Continue : )
49
+ def send_context_email ctx_id
50
+ @ctx = Ctx.find ctx_id
51
+ @lead = Wco::Lead.find @ctx.lead_id
52
+ @tmpl_config = OpenStruct.new JSON.parse( @ctx.tmpl[:config_json] )
53
+
54
+ @utm_tracking_str = {
55
+ 'cid' => @ctx.lead_id,
56
+ 'utm_campaign' => @ctx.tmpl.slug,
57
+ 'utm_medium' => 'email',
58
+ 'utm_source' => @ctx.tmpl.slug,
59
+ }.map { |k, v| "#{k}=#{v}" }.join("&")
60
+
61
+ # @origin = "https://#{Rails.application.config.action_mailer.default_url_options[:host]}"
62
+
63
+ @unsubscribe_url = WcoEmail::Engine.routes.url_helpers.unsubscribes_url({
64
+ template_id: @ctx.tmpl.id,
65
+ lead_id: @lead.id,
66
+ token: @lead.unsubscribe_token,
67
+ host: Rails.application.routes.default_url_options[:host],
68
+ })
69
+ # renderer = Tmp6Ctl.new
70
+ # renderer = IshManager::ApplicationController.new
71
+ # renderer.send( :include, ::IshManager::ApplicationHelper )
72
+ # renderer.send( :request, { host: 'test-host' } )
73
+ renderer = WcoEmail::ApplicationMailer.new
74
+
75
+ renderer.instance_variable_set( :@ctx, @ctx )
76
+ renderer.instance_variable_set( :@lead, @ctx.lead )
77
+ renderer.instance_variable_set( :@utm_tracking_str, @utm_tracking_str )
78
+ renderer.instance_variable_set( :@unsubscribe_url, @unsubscribe_url )
79
+ renderer.instance_variable_set( :@tmpl_config, @tmpl_config )
80
+
81
+ # eval( @ctx.tmpl.config_exe )
82
+
83
+ rendered_str = renderer.render_to_string("/wco_email/email_templates/_#{@ctx.tmpl.layout}")
84
+ @ctx.update({
85
+ rendered_str: rendered_str,
86
+ sent_at: Time.now.to_s,
87
+ })
88
+
89
+ mail( from: @ctx.from_email,
90
+ to: @ctx.to_email,
91
+ cc: @ctx.cc,
92
+ bcc: "poxlovi@gmail.com",
93
+ subject: ERB.new( @ctx.subject ).result( @ctx.get_binding ),
94
+ body: rendered_str,
95
+ content_type: "text/html" )
96
+ end
97
+
98
+ end
@@ -8,6 +8,9 @@ class WcoEmail::Context
8
8
  include Mongoid::Paranoia
9
9
  store_in collection: 'ish_email_contexts'
10
10
 
11
+ PAGE_PARAM_NAME = 'email_contexts_page'
12
+
13
+
11
14
  field :slug
12
15
  validates_uniqueness_of :slug, allow_nil: true
13
16
 
@@ -29,7 +32,6 @@ class WcoEmail::Context
29
32
  end
30
33
  end
31
34
 
32
- PAGE_PARAM_NAME = 'email_contexts_page'
33
35
 
34
36
  field :from_email
35
37
  def from_email
@@ -44,7 +46,7 @@ class WcoEmail::Context
44
46
 
45
47
  field :subject
46
48
  def subject
47
- self[:subject].presence || tmpl.subject
49
+ self[:subject].presence || tmpl&.subject
48
50
  end
49
51
 
50
52
  belongs_to :reply_to_message, class_name: 'WcoEmail::Message', inverse_of: :replies, optional: true
@@ -8,6 +8,8 @@ class WcoEmail::EmailFilter
8
8
  include Mongoid::Paranoia
9
9
  store_in collection: 'office_email_filters' # 'wco_email_email_filters'
10
10
 
11
+ PAGE_PARAM_NAME = :filters_page
12
+
11
13
  field :from_regex
12
14
  field :from_exact
13
15
  field :subject_regex
@@ -76,32 +76,34 @@ class WcoEmail::Message
76
76
  has_many :replies, class_name: '::WcoEmail::Context', inverse_of: :reply_to_message
77
77
 
78
78
  def apply_filter filter
79
+ puts! filter, 'WcoEmail::Message#apply_filter'
80
+
79
81
  case filter.kind
80
82
 
81
- when ::Office::EmailFilter::KIND_DESTROY_SCHS
83
+ when WcoEmail::EmailFilter::KIND_DESTROY_SCHS
82
84
  conv.add_tag ::WpTag::TRASH
83
85
  conv.remove_tag ::WpTag::INBOX
84
86
  lead.schs.each do |sch|
85
87
  sch.update_attributes({ state: ::Sch::STATE_TRASH })
86
88
  end
87
89
 
88
- when ::Office::EmailFilter::KIND_ADD_TAG
90
+ when WcoEmail::EmailFilter::KIND_ADD_TAG
89
91
  conv.add_tag filter.wp_term_id
90
92
  if ::WpTag::TRASH == ::WpTag.find( filter.wp_term_id ).slug
91
93
  conv.remove_tag ::WpTag::INBOX
92
94
  end
93
95
 
94
- when ::Office::EmailFilter::KIND_REMOVE_TAG
96
+ when WcoEmail::EmailFilter::KIND_REMOVE_TAG
95
97
  conv.remove_tag filter.wp_term_id
96
98
 
97
- when ::Office::EmailFilter::KIND_AUTORESPOND_TMPL
99
+ when WcoEmail::EmailFilter::KIND_AUTORESPOND_TMPL
98
100
  Ish::EmailContext.create({
99
101
  email_template: filter.email_template,
100
102
  lead_id: lead.id,
101
103
  send_at: Time.now + 22.minutes,
102
104
  })
103
105
 
104
- when ::Office::EmailFilter::KIND_AUTORESPOND_EACT
106
+ when WcoEmail::EmailFilter::KIND_AUTORESPOND_EACT
105
107
  ::Sch.create({
106
108
  email_action: filter.email_action,
107
109
  state: ::Sch::STATE_ACTIVE,
@@ -33,6 +33,10 @@ class WcoEmail::MessageStub
33
33
 
34
34
  has_and_belongs_to_many :tags, class_name: 'Wco::Tag'
35
35
 
36
+ ##
37
+ ## skip_notification
38
+ ## process_images
39
+ ##
36
40
  field :config, type: Object, default: <<~AOL
37
41
  {}
38
42
  AOL
@@ -53,11 +57,11 @@ class WcoEmail::MessageStub
53
57
  # puts! message_id, 'message_id'
54
58
 
55
59
  in_reply_to_id = the_mail.header['in-reply-to']&.to_s
56
- puts! in_reply_to_id, 'in_reply_to_id'
60
+ # puts! in_reply_to_id, 'in_reply_to_id'
57
61
 
58
62
  the_mail.to = [ 'NO-RECIPIENT' ] if !the_mail.to
59
63
  subject = WcoEmail::Message.strip_emoji( the_mail.subject || '(wco-no-subject)' )
60
- puts! subject, 'subject'
64
+ # puts! subject, 'subject'
61
65
 
62
66
  ## Conversation
63
67
  if in_reply_to_id
@@ -94,6 +98,7 @@ class WcoEmail::MessageStub
94
98
  message.save!( validate: false )
95
99
  message.delete
96
100
  end
101
+
97
102
  @message = WcoEmail::Message.create!({
98
103
  stub: stub,
99
104
  conversation: conv,
@@ -115,6 +120,7 @@ class WcoEmail::MessageStub
115
120
  cc: the_mail.cc ? the_mail.cc[0] : nil,
116
121
  ccs: the_mail.cc,
117
122
  })
123
+ puts! @message, '@message'
118
124
 
119
125
  ## Parts
120
126
  the_mail.parts.each do |part|
@@ -148,8 +154,6 @@ class WcoEmail::MessageStub
148
154
 
149
155
  conv.leads.push lead
150
156
  conv.save
151
- # lead.conversations.push conv
152
- # lead.save
153
157
 
154
158
  the_mail.cc&.each do |cc|
155
159
  domain = cc.split('@')[1] rescue 'unknown.domain'
@@ -171,23 +175,30 @@ class WcoEmail::MessageStub
171
175
  conv.tags.push inbox_tag
172
176
  conv.tags.push stub.tags
173
177
  conv.save
174
- # inbox_tag.conversations.push conv
175
- # inbox_tag.save
176
178
 
177
179
 
178
180
  ## Actions & Filters
179
181
  email_filters = WcoEmail::EmailFilter.active
180
182
  email_filters.each do |filter|
181
- if ( filter.from_regex.blank? || @message.from.match( filter.from_regex ) ) &&
182
- ( filter.from_exact.blank? || @message.from.downcase.include?( filter.from_exact&.downcase ) ) &&
183
- ( filter.body_exact.blank? || @message.part_html&.include?( filter.body_exact ) ) &&
184
- ( filter.subject_regex.blank? || @message.subject.match( filter.subject_regex ) ) &&
185
- ( filter.subject_exact.blank? || @message.subject.downcase.include?( filter.subject_exact&.downcase ) )
186
-
187
- # || MiaTagger.analyze( @message.part_html, :is_spammy_recruite ).score > .5
188
-
189
- puts! "applying filter #{filter} to conv #{conv}" if DEBUG
183
+ reson = nil
184
+ if filter.from_regex && @message.from.downcase.match( filter.from_regex )
185
+ reason = 'from_regex'
186
+ end
187
+ if filter.from_exact && @message.from.downcase.include?( filter.from_exact.downcase )
188
+ reason = 'from_exact'
189
+ end
190
+ if filter.body_exact && @message.part_html&.include?( filter.body_exact )
191
+ reason = 'body_exact'
192
+ end
193
+ if filter.subject_regex && @message.subject.match( filter.subject_regex )
194
+ reason = 'subject_regex'
195
+ end
196
+ if filter.subject_exact && @message.subject.downcase.include?( filter.subject_exact.downcase )
197
+ reason = 'subject_exact'
198
+ end
190
199
 
200
+ if reason
201
+ puts! "Applying filter #{filter} to conv #{conv} for matching #{reason}" if DEBUG
191
202
  @message.apply_filter( filter )
192
203
  end
193
204
  end
@@ -0,0 +1,17 @@
1
+
2
+
3
+ <ul>
4
+ <li><b>From:</b> <%= @msg.from %></li>
5
+ <li><b>To:</b> <%= @msg.to %></li>
6
+ <li><b>Cc:</b> <%= @msg.cc %></li>
7
+ <li><b>Subject:</b> <%= @msg.subject %></li>
8
+ <li><b>Date:</b> <%= @msg.date %></li>
9
+ <li><b>N Assets:</b> <%= @msg.assets.length %></li>
10
+ </ul>
11
+
12
+ <%= raw @msg.part_html %>
13
+
14
+ <hr />
15
+
16
+ <%= raw @msg.part_txt %>
17
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.57
4
+ version: 3.1.0.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-11 00:00:00.000000000 Z
11
+ date: 2024-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -383,7 +383,7 @@ files:
383
383
  - app/controllers/wco/videos_controller.rb
384
384
  - app/helpers/wco/application_helper.rb
385
385
  - app/jobs/wco_hosting/certbot_job.rb
386
- - app/mailers/ish_models/application_mailer.rb
386
+ - app/mailers/wco_email/application_mailer.rb
387
387
  - app/models/ability.rb
388
388
  - app/models/wco/asset.rb
389
389
  - app/models/wco/gallery.rb
@@ -560,6 +560,7 @@ files:
560
560
  - app/views/wco/videos/trash/_list_small.haml
561
561
  - app/views/wco/videos/trash/_meta_edit.haml
562
562
  - app/views/wco/videos/trash/_preview.haml
563
+ - app/views/wco_email/application_mailer/forwarder_notify.html.erb
563
564
  - app/views/wco_hosting/docker-compose/dc-any.erb
564
565
  - app/views/wco_hosting/docker-compose/dc-helloworld.erb
565
566
  - app/views/wco_hosting/docker-compose/dc-wordpress.erb
@@ -1,6 +0,0 @@
1
- module IshModels
2
- class ApplicationMailer < ActionMailer::Base
3
- default from: 'from@example.com'
4
- layout 'mailer'
5
- end
6
- end