wco_email 0.1.1.15 → 0.1.1.17

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e60e5717005c4eeedca0acf6cc252d756c1c89207e33433461c61375e0cbf6d
4
- data.tar.gz: 8b9795b50a69d6cf743e41853981b30440ebee9b23e8a96b936ae281d76c42f7
3
+ metadata.gz: 9ee31f07f0214ecc2c291ebd5ad7b72178fa589f14ab0851d14cb95973a83a04
4
+ data.tar.gz: d9b626b34660c3ac056bb7cffb6a80a2baf756d2d26d87c5f8e523690f020fce
5
5
  SHA512:
6
- metadata.gz: dc1c955765c2190d06dd36ed77ffa242f94a8974f08c28e05b5ad0423df1ddc2aaae1dc3bca230589f527f6fbf65557b6247eb4cf9757bbb38df1b2c421879d6
7
- data.tar.gz: d0c3b726e150d2323f3042933cdee095b02517aaa9069e0050721dbe24750f87952ab27996c3827d517c1189bab1d0c4096a693adcdc9763ddb8dde2e9ecf0c8
6
+ metadata.gz: 3052c43baec0b9f77a4435d78d97803a3652ed3856a613691b427ae819bad13907787889f291a09a800159a7c5c0a2aec1f556418fb90cb838cb7c05e65d1822
7
+ data.tar.gz: ee8fd66a96b4ae2d3e5db106e13604fc5e931e5d5adde8d6cfdaf47597b0d1338b61c1dbfd84a1fb98115bb1c708b2087eadbf3521893a51ed51ae098fe50685
@@ -7,7 +7,7 @@ class WcoEmail::ApiController < ActionController::Base
7
7
  def create_email_message
8
8
  puts! params, 'params'
9
9
 
10
- stub = WcoEmail::MessageStub.create!({
10
+ stub = WcoEmail::MessageStub.find_or_create_by({
11
11
  bucket: params[:bucket],
12
12
  object_key: params[:object_key],
13
13
  })
@@ -1,20 +1,4 @@
1
1
 
2
2
  module WcoEmail::ApplicationHelper
3
3
 
4
- def pretty_date date
5
- # date.to_s[0, 10]
6
- date&.strftime('%Y-%m-%d')
7
- end
8
- def pp_date a; pretty_date a; end
9
-
10
- def pp_datetime date
11
- date&.strftime('%Y-%m-%d %l:%M%P %z')
12
- end
13
-
14
- def pp_time date
15
- return nil if !date
16
- # return date.strftime('%l:%M%P %z')
17
- return date.in_time_zone( Rails.application.config.time_zone ).strftime('%l:%M%P')
18
- end
19
-
20
4
  end
@@ -1,31 +1,30 @@
1
1
 
2
- .application--main-header.main-header.maxwidth{ class: "#{ENV['RAILS_ENV']} #{ENV['RAILS_ENV'][0...3]=="dev" ? "development" : ''}" }
2
+ .application--main-header.main-header{ class: "#{ENV['RAILS_ENV']} #{ENV['RAILS_ENV'][0...3]=="dev" ? "development" : ''}" }
3
+ .maxwidth
4
+ %i.fa.fa-compress.collapse-expand#collapseHeaderEmail
5
+ Wco Email & CRM
6
+ .flex-row
7
+ %ul
8
+ %li= link_to 'Email Messages', conversations_path
9
+ %li
10
+ Stubs
11
+ (#{WcoEmail::MessageStub.pending.length})
12
+ (#{WcoEmail::MessageStub.all.length})
13
+ %li= render '/wco_email/email_templates/header'
14
+ %li= render '/wco_email/email_campaigns/header'
15
+ %li= render '/wco_email/email_filters/header'
16
+ %li= render '/wco_email/contexts/header'
17
+ %li= render '/wco_email/unsubscribes/header'
3
18
 
4
- %i.fa.fa-compress.collapse-expand#collapseHeaderEmail
5
- Wco Email & CRM
6
- .flex-row
7
- %ul
8
- %li= link_to 'Email Messages', conversations_path
9
- %li
10
- Stubs
11
- (#{WcoEmail::MessageStub.pending.length})
12
- (#{WcoEmail::MessageStub.all.length})
13
- %li= render '/wco_email/email_templates/header'
14
- %li= render '/wco_email/email_campaigns/header'
15
- %li= render '/wco_email/email_filters/header'
16
- %li= render '/wco_email/contexts/header'
17
- %li= render '/wco_email/unsubscribes/header'
18
19
 
20
+ %ul
21
+ %li= render '/wco_email/email_action_templates/header'
22
+ %li= render '/wco_email/email_actions/header'
19
23
 
20
- %ul
21
- %li= render '/wco_email/email_action_templates/header'
22
- %li= render '/wco_email/email_actions/header'
24
+ -# %li= render '/wco_email/lead_action_templates/header'
25
+ -# %li= render '/wco_email/lead_actions/header'
23
26
 
24
- -# %li= render '/wco_email/lead_action_templates/header'
25
- -# %li= render '/wco_email/lead_actions/header'
27
+ -# %li
28
+ -# = link_to "OActions (#{Wco::OfficeAction.all.length})", office_actions_path
29
+ -# = link_to '[+]', new_office_action_path
26
30
 
27
- -# %li
28
- -# = link_to "OActions (#{Wco::OfficeAction.all.length})", office_actions_path
29
- -# = link_to '[+]', new_office_action_path
30
-
31
- .c
@@ -1,8 +1,4 @@
1
1
 
2
- -#
3
- -# WARNING: this is used by contexts, not templates, so @TODO: review _vp_ 2023-03-26
4
- -#
5
-
6
2
  = raw ERB.new( @ctx.body ).result
7
3
 
8
4
  -# = @ctx.reply_to_message.inspect
@@ -1,34 +1,37 @@
1
1
 
2
- =begin
3
-
2
+ namespace :db do
4
3
 
5
- ## clean
6
- WcoEmail::EmailAction.each do |act|
7
- if !act.lead
8
- act.delete
4
+ desc "clean contexts"
5
+ task clean_contexts: :environment do
6
+ WcoEmail::Context.each do |ttt|
7
+ if !ttt.lead
8
+ ttt.delete
9
+ end
10
+ end
9
11
  end
10
- end
11
-
12
12
 
13
-
14
- ## clean
15
- WcoEmail::Context.each do |ttt|
16
- if !ttt.lead
17
- ttt.delete
13
+ desk 'clean email actions'
14
+ task clean_email_actions: :environment do
15
+ WcoEmail::EmailAction.each do |act|
16
+ if !act.lead
17
+ act.delete
18
+ end
19
+ end
18
20
  end
19
- end
20
-
21
-
22
- =end
23
-
24
- namespace :db do
25
21
 
26
22
  desc "seed"
27
23
  task seed: :environment do
24
+
28
25
  inbox = Wco::Tag.find_or_create_by({ slug: 'inbox' })
29
26
  trash = Wco::Tag.find_or_create_by({ slug: 'trash' })
27
+ spam = Wco::Tag.find_or_create_by({ slug: 'spam' })
28
+
29
+ wasyaco = Wco::Leadset.find_or_create_by!({ company_url: 'wasya.co' })
30
+
31
+ poxlovi = Wco::Lead.find_or_create_by!({ email: 'poxlovi@gmail.com' })
32
+ piousbox = Wco::Lead.find_or_create_by!({ email: 'piousbox@gmail.com' })
33
+ victor = Wco::Lead.find_or_create_by!({ email: 'victor@wasya.co' })
30
34
 
31
- poxlovi = Wco::Lead.find_or_create_by!({ email: 'poxlovi@gmail.com' })
32
35
  end
33
36
 
34
37
  end
@@ -37,6 +37,9 @@ namespace :wco_email do
37
37
  stub.save!
38
38
 
39
39
  WcoEmail::MessageIntakeJob.perform_sync( stub.id.to_s )
40
+
41
+ sleep 1 # second
42
+ print '.'
40
43
  end
41
44
  end
42
45
 
@@ -107,6 +110,20 @@ namespace :wco_email do
107
110
  puts "ok"
108
111
  end
109
112
 
113
+ desc 'remove message duplicates'
114
+ task remove_message_duplicates: :environment do
115
+ outs = WcoEmail::Message.collection.aggregate([
116
+ {"$group" => { "_id" => "$message_id", "count" => { "$sum" => 1 } } },
117
+ {"$match": {"_id" => { "$ne" => nil } , "count" => {"$gt" => 1} } },
118
+ {"$project" => {"message_id" => "$_id", "_id" => 0} }
119
+ ])
120
+ outs = outs.to_a
121
+ outs.each do |out|
122
+ WcoEmail::Message.where( message_id: out['message_id'] )[1].destroy!
123
+ print '.'
124
+ end
125
+ end
126
+
110
127
  desc 'remove duplicates of stubs'
111
128
  task remove_stub_duplicates: :environment do
112
129
  outs = WcoEmail::MessageStub.collection.aggregate([
@@ -130,7 +147,7 @@ namespace :wco_email do
130
147
  print '^'
131
148
  end
132
149
 
133
- duration = Rails.env.production? ? 120 : 15 # 2 minutes or 15 seconds
150
+ duration = Rails.env.production? ? 15 : 15 # 2 minutes or 15 seconds
134
151
  sleep duration
135
152
  print '.'
136
153
 
@@ -165,7 +182,7 @@ namespace :wco_email do
165
182
  print '^'
166
183
  end
167
184
 
168
- duration = Rails.env.production? ? 120 : 15 # 2 minutes or 15 seconds
185
+ duration = Rails.env.production? ? 15 : 15 # 2 minutes or 15 seconds
169
186
  sleep duration
170
187
  print '.'
171
188
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.15
4
+ version: 0.1.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev