ish_models 0.0.33.251 → 0.0.33.253

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: 97694f897a05630940ab25cfb2db45b30d5c00c3c32dd114ae5fed006ce7c588
4
- data.tar.gz: 86722a0cd7ee353ead0282d2a39df5218aa3e2d56be73b0493e3ff4557d00ed5
3
+ metadata.gz: b6e7781a7b0b7cbc076420a3cfb28cb0d744b01501a22608e0b00d8118d01abd
4
+ data.tar.gz: 712ba5793e6f2c1d0f77cd4465633d4189a8586113e9c2d4a3e06464c111f4f2
5
5
  SHA512:
6
- metadata.gz: 169c1e3519c001582644484d24c33fb5fe7c46e7f7e526d36d0f38d9f2b8003277d334666507a1fc9b3079fd7da8fa4f82972276c9d26ea1f2ac3c2551d15838
7
- data.tar.gz: 75df8f2672752b36797c7f2c10b2fcbea89855601b30ec2050ea6bf48896559995554cb0817f75e99d1a4712b1f9b9c9b7598d2b7efe8de28160ef5fb3a6abad
6
+ metadata.gz: e795efdb559bcd28b50181aa10520f0d7e05b5a28828e8d2d305fbe0de189e2ab35d7cd1e0dd8714b330d38c940ad7eae999860aed4ea41700ebe831e380f2fd
7
+ data.tar.gz: fc320600843eb3bf82df82665850fe1038a1d73a46e081068dfd5a75b68f10a744a9fe37d11daa5f124362202a8faf268d44b4b76ea401ddbfc0aeb32029ed8c
@@ -87,7 +87,7 @@ class ::Ish::EmailContext
87
87
  def self.summary
88
88
  pipeline = [
89
89
  { '$group' => {
90
- '_id' => { '$dateToString' => { 'format' => "%Y-%m-%d", 'date' => "$sent_at" } }, 'total' => { '$sum' => 1 }
90
+ '_id' => { '$dateToString' => { 'format' => "%Y-%m-%d", 'date' => "$sent_at", 'timezone' => 'America/Chicago' } }, 'total' => { '$sum' => 1 }
91
91
  } },
92
92
  { '$sort' => { '_id': -1 } },
93
93
  ]
@@ -18,12 +18,13 @@ class Office::EmailFilter
18
18
  KIND_AUTORESPOND_EACT = 'autorespond-email-action'
19
19
  KIND_REMOVE_TAG = 'remove-tag'
20
20
  KIND_ADD_TAG = 'add-tag'
21
+ KIND_DESTROY_SCHS = 'destroy-schs'
21
22
 
22
23
  KIND_AUTORESPOND = 'autorespond' # @deprecated, DO NOT USE!
23
24
  KIND_DELETE = 'delete' # @deprecated, use add-tag
24
25
  KIND_SKIP_INBOX = 'skip-inbox' # @deprecated, use remove-tag
25
26
 
26
- KINDS = [ nil, KIND_AUTORESPOND_TMPL, KIND_AUTORESPOND_EACT, KIND_ADD_TAG, KIND_REMOVE_TAG]
27
+ KINDS = [ nil, KIND_AUTORESPOND_TMPL, KIND_AUTORESPOND_EACT, KIND_ADD_TAG, KIND_REMOVE_TAG, KIND_DESTROY_SCHS]
27
28
  field :kind
28
29
 
29
30
  STATE_ACTIVE = 'active'
@@ -94,8 +94,19 @@ class Office::EmailMessage
94
94
  def apply_filter filter
95
95
  case filter.kind
96
96
 
97
+ when ::Office::EmailFilter::KIND_DESTROY_SCHS
98
+ self.conv.add_tag( ::WpTag::TRASH )
99
+ self.conv.remove_tag( ::WpTag::INBOX )
100
+ tmp_lead = ::Lead.where( email: self.part_txt.split("\n")[1] ).first
101
+ if tmp_lead
102
+ tmp_lead.schs.each { |sch| sch.update_attributes({ state: ::Sch::STATE_TRASH }) }
103
+ end
104
+
97
105
  when ::Office::EmailFilter::KIND_ADD_TAG
98
106
  self.conv.add_tag( filter.wp_term_id )
107
+ if ::WpTag::TRASH == ::WpTag.find( filter.wp_term_id ).slug
108
+ self.conv.remove_tag(::WpTag::INBOX )
109
+ end
99
110
 
100
111
  when ::Office::EmailFilter::KIND_REMOVE_TAG
101
112
  self.conv.remove_tag( filter.wp_term_id )
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.251
4
+ version: 0.0.33.253
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox