ish_models 0.0.33.282 → 0.0.33.283

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: e5f09926e50bdfd5eb47e0d54068d1e489da436ac66a04cbcbbdf512c54bd08d
4
- data.tar.gz: '060097f0e62e56a7b6a531d59688818156395c197fddd4e6f99ec9e2a61d2372'
3
+ metadata.gz: f08684b167a8a9dd2f48caf9441d0c328ce9fef962a3964feeb0fb067a74db6c
4
+ data.tar.gz: d006ee0f98934aa7b7146fbd434faa81e696a48e8f391381ed9dd78d4b70be7f
5
5
  SHA512:
6
- metadata.gz: 218fbb19117f7f2fd8cfb16b3bd42a926842c01935d533d38a0032f04161128a670cb618e38b3335e6f0e69b927f6b318923734f9f09195f353b1bfb182269c6
7
- data.tar.gz: 8bbc63978210f3b2e2d33887aa89ae65ad89f70c15be228eafa22604dec316727cda6bbfcc1c0af9f58fb34be468ebbbcd8bab23674476e11f0a95d97c565a91
6
+ metadata.gz: 04a4903ee82b65803e0cadd5b2235935ce9041f6c442defd558c3d81e14a522a47d6510aaf69e32b71d0bd5c16a9f8590acd7fa7506417ab17789e34fd59f88a
7
+ data.tar.gz: 5bae3c73bc973fb0b240b9cfba54cc42e2de35c6257226dc386d130bc0f272a3a2bb770e0d42144f127a2bf3b782b0ce3b6cc9aa8032aa181e1438f0bbc5cf95
@@ -26,7 +26,7 @@ class ::Ish::EmailTemplate
26
26
  field :subject
27
27
  field :body
28
28
  field :can_unsubscribe, type: :boolean, default: true
29
- field :config_exe, default: "" ## used a lot.
29
+ field :config_exe, default: "" ## unused! _vp_ 2023-09-24
30
30
  field :config_json, type: Object, default: '{}'
31
31
 
32
32
  FROM_EMAILS = [
@@ -73,47 +73,6 @@ class Office::EmailConversation
73
73
  end
74
74
 
75
75
 
76
- def apply_filter filter
77
- case filter.kind
78
-
79
- when ::Office::EmailFilter::KIND_DESTROY_SCHS
80
- add_tag ::WpTag::TRASH
81
- remove_tag ::WpTag::INBOX
82
- tmp_lead = ::Lead.where( email: self.part_txt.split("\n")[1] ).first
83
- if tmp_lead
84
- tmp_lead.schs.each do |sch|
85
- sch.update_attributes({ state: ::Sch::STATE_TRASH })
86
- end
87
- end
88
-
89
- when ::Office::EmailFilter::KIND_ADD_TAG
90
- add_tag filter.wp_term_id
91
- if ::WpTag::TRASH == ::WpTag.find( filter.wp_term_id ).slug
92
- remove_tag ::WpTag::INBOX
93
- end
94
-
95
- when ::Office::EmailFilter::KIND_REMOVE_TAG
96
- remove_tag filter.wp_term_id
97
-
98
- when ::Office::EmailFilter::KIND_AUTORESPOND_TMPL
99
- Ish::EmailContext.create({
100
- email_template: filter.email_template,
101
- lead_id: lead.id,
102
- send_at: Time.now + 22.minutes,
103
- })
104
-
105
- when ::Office::EmailFilter::KIND_AUTORESPOND_EACT
106
- ::Sch.create({
107
- email_action: filter.email_action,
108
- state: ::Sch::STATE_ACTIVE,
109
- lead_id: lead.id,
110
- perform_at: Time.now + 22.minutes,
111
- })
112
-
113
- else
114
- raise "unknown filter kind: #{filter.kind}"
115
- end
116
- end
117
76
 
118
77
 
119
78
 
@@ -58,6 +58,47 @@ class Office::EmailMessage
58
58
  body
59
59
  end
60
60
 
61
+
62
+ def apply_filter filter
63
+ case filter.kind
64
+
65
+ when ::Office::EmailFilter::KIND_DESTROY_SCHS
66
+ conv.add_tag ::WpTag::TRASH
67
+ conv.remove_tag ::WpTag::INBOX
68
+ lead.schs.each do |sch|
69
+ sch.update_attributes({ state: ::Sch::STATE_TRASH })
70
+ end
71
+
72
+ when ::Office::EmailFilter::KIND_ADD_TAG
73
+ conv.add_tag filter.wp_term_id
74
+ if ::WpTag::TRASH == ::WpTag.find( filter.wp_term_id ).slug
75
+ conv.remove_tag ::WpTag::INBOX
76
+ end
77
+
78
+ when ::Office::EmailFilter::KIND_REMOVE_TAG
79
+ conv.remove_tag filter.wp_term_id
80
+
81
+ when ::Office::EmailFilter::KIND_AUTORESPOND_TMPL
82
+ Ish::EmailContext.create({
83
+ email_template: filter.email_template,
84
+ lead_id: lead.id,
85
+ send_at: Time.now + 22.minutes,
86
+ })
87
+
88
+ when ::Office::EmailFilter::KIND_AUTORESPOND_EACT
89
+ ::Sch.create({
90
+ email_action: filter.email_action,
91
+ state: ::Sch::STATE_ACTIVE,
92
+ lead_id: lead.id,
93
+ perform_at: Time.now + 22.minutes,
94
+ })
95
+
96
+ else
97
+ raise "unknown filter kind: #{filter.kind}"
98
+ end
99
+ end
100
+
101
+
61
102
  end
62
103
  ::Msg = Office::EmailMessage
63
104
 
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.282
4
+ version: 0.0.33.283
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox