ish_models 0.0.33.250 → 0.0.33.252

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: 22ede27935043d3acbca5e217b8accd8e8749bb873fa0c2fec31d66959c5e8f1
4
- data.tar.gz: 87c6f2a10a48a2b960a1dee94f1e4363609a76befa030d7bbc3d306de3c49f41
3
+ metadata.gz: 92e37a2bcbeb0a4ab4bfeaedb4b433476254ee059e28e2d5e2aa5000121e0d68
4
+ data.tar.gz: 99bc9aabbebcbfcebbb2ba2d51fcd1ef08075df67090fac8d0e970ce297f8ae5
5
5
  SHA512:
6
- metadata.gz: 392b97f6f8e9df5b1d309ea43035369927ddde49e41a2770045f95c49c21718db1eb2c07ffaa85df67d511ecadc736aa18bd1bf4659abf3a87de5d9d6bba484f
7
- data.tar.gz: ff3b10c7292ba050c3365fcf302c24ac0a89c93f1842edcf2289d75e14860aaf14bd73b86a0c642f683e8ac0411ef1dace1b46c5765abe47495d75958b95fbc7
6
+ metadata.gz: 95b609cb864e00524968d0e53aa5df3266eef7592781329a2e3b9218ff1a1a07195e6b0125d24b7c0370a1163b4e47e10ea4d45708f514ea6137719ab0966f99
7
+ data.tar.gz: 72f14dd504eea91951cbe503c23561a11d8ff12d22326c846d75fc589a152af6a51bb0c5d4949ca06b6a7b5d939951dc9d03f92fb8c3e3b34a0a9321b06888c2
@@ -53,6 +53,7 @@ class ::Ish::EmailTemplate
53
53
  def self.blank_template
54
54
  out = Tmpl.find_or_create_by({ slug: SLUG_BLANK })
55
55
  end
56
+ def self.blank; self.blank_template; end
56
57
 
57
58
  end
58
59
  ::Tmpl = ::Ish::EmailTemplate
@@ -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.250
4
+ version: 0.0.33.252
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox