wco_models 3.1.0.192 → 3.1.0.194

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: dbba6285ae64aa8c8bd1dbebcf4316b2ecb2e7d81f2143220d6e2d00e2b8833b
4
- data.tar.gz: 7fe94b7db4a4f1147c0634bfdbb772cb07295870a1bdec024c855eca46e7996f
3
+ metadata.gz: 7b3538da96d43d2b858d411c19ebc17ec895fc80775ab8fae866c6ba5eef66b4
4
+ data.tar.gz: f62962e74f94fa28d1252d72502470fd3b7dce833d875e2a86648138b613ec67
5
5
  SHA512:
6
- metadata.gz: 194d52d31e7fc74009341a9d64008515b4510d0f804542308cb28d11617c41765ee536d683149a9dc412d26770ba17a805ca5feb89b509a59053565e617c599e
7
- data.tar.gz: 12e385987d60859fc429da32d697d7bd7dcd2c0e8fe37855b389e3b3bcafd6903e57816efe42accad974e8f6edd0b25a6709b0a14a6282d2661ce8ec5fc68d33
6
+ metadata.gz: aeed39e89ebbc919a75fa436a36a7b69c154839f17825aa72007766f728c99ae30cd9b22792c1b058d9745e3bbc6ec2f2ebece2cb69d2568bb841d5e8c2eee6d
7
+ data.tar.gz: cc252f6b9a5799cc4aa1835d4b74163ed981cd14c268f529dce89e321fb8466d28d39864e2fd57a804708c3549353a8f4bd42ba703f488f33362a6c90ef01139
data/README.txt CHANGED
@@ -9,3 +9,12 @@ Login to the localstack container, then:
9
9
  --key 00nn652jk1395ujdr3l11ib06jam0oevjqv2o4g1 \
10
10
  --body /opt/tmp/00nn652jk1395ujdr3l11ib06jam0oevjqv2o4g1
11
11
 
12
+ In ruby console:
13
+
14
+ stub = WcoEmail::MessageStub.create({
15
+ object_key: '00nn652jk1395ujdr3l11ib06jam0oevjqv2o4g1',
16
+ bucket: 'wco-email-ses-development',
17
+ config: { process_images: false }.to_json,
18
+ })
19
+ stub.do_process
20
+
@@ -39,3 +39,21 @@ class Wco::OfficeActionTemplate
39
39
  end
40
40
  end
41
41
  # OAT ||= Wco::OfficeActionTemplate
42
+
43
+ ## mark-leadsets-as-spam
44
+ =begin
45
+
46
+ @conversations.each do |c|
47
+ c.tags.delete( Wco::Tag.inbox )
48
+ c.save
49
+ c.leadsets.each do |leadset|
50
+ leadset.tags.delete( Wco::Tag.not_spam )
51
+ leadset.tags.push( Wco::Tag.spam )
52
+ leadset.save
53
+ end
54
+ # print('.')
55
+ end
56
+
57
+ =end
58
+
59
+
@@ -37,6 +37,7 @@ class WcoEmail::EmailFilter
37
37
  ## 'and' - all conditions must match, for filter to match
38
38
  has_many :skip_conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_skip_filter
39
39
  accepts_nested_attributes_for :skip_conditions, allow_destroy: true
40
+
40
41
  validate :validate_conditions
41
42
  def validate_conditions
42
43
  if conditions.length + skip_conditions.length == 0
@@ -42,6 +42,6 @@ class WcoEmail::EmailFilterAction
42
42
  if [ KIND_AUTORESPOND ].include?( kind )
43
43
  _value = WcoEmail::EmailTemplate.find( value )
44
44
  end
45
- "#{" " * indent }<EmailFilterAction #{kind} `#{_value}` />\n"
45
+ "#{" " * indent }<EFAction #{kind} `#{_value}` />\n"
46
46
  end
47
47
  end
@@ -18,15 +18,37 @@ class WcoEmail::EmailFilterCondition
18
18
  field :value
19
19
  validates :value, presence: true
20
20
 
21
+ def apply leadset:, message:
22
+ cond = self
23
+ reason = nil
24
+ case cond.field
25
+ when WcoEmail::FIELD_LEADSET
26
+ if cond.operator == WcoEmail::OPERATOR_NOT_HAS_TAG
27
+ this_tag = Wco::Tag.find cond.value
28
+ if leadset.tags.include?( this_tag )
29
+ ;
30
+ else
31
+ reason = "{email_skip_filter ? 'skip_' : ''}condition leadset not-has-tag #{this_tag} NOT met"
32
+ end
33
+ end
34
+ when WcoEmail::FIELD_TO
35
+ if message.to == cond.value
36
+ reason = "{email_skip_filter ? 'skip_' : ''}condition to = #{cond.value}"
37
+ end
38
+ end
39
+ return reason
40
+ end
41
+
42
+
21
43
  def to_s
22
44
  "<EFC #{field} #{operator} #{value} />"
23
45
  end
24
46
  def to_s_full indent: 0
25
47
  _value = value
26
- if [ OPERATOR_HAS_TAG, OPERATOR_NOT_HAS_TAG ].include?( operator )
48
+ if [ ::WcoEmail::OPERATOR_HAS_TAG, ::WcoEmail::OPERATOR_NOT_HAS_TAG ].include?( operator )
27
49
  _value = Wco::Tag.find( value )
28
50
  end
29
- "#{" " * indent }<EmailFilterCondition #{field} #{operator} `#{_value}` />\n"
51
+ "#{" " * indent }<EF#{email_skip_filter ? 'Skip' : ''}Condition #{field} #{operator} `#{_value}` />\n"
30
52
  end
31
53
  end
32
54
 
@@ -199,22 +199,8 @@ class WcoEmail::MessageStub
199
199
  reason = 'subject_exact'
200
200
  end
201
201
 
202
- filter.conditions.each do |cond|
203
- case cond.field
204
- when WcoEmail::FIELD_LEADSET
205
- if cond.operator == WcoEmail::OPERATOR_NOT_HAS_TAG
206
- this_tag = Wco::Tag.find cond.value
207
- if leadset.tags.include?( this_tag )
208
- ;
209
- else
210
- reason = "condition leadset not-has-tag #{this_tag} NOT met"
211
- end
212
- end
213
- when WcoEmail::FIELD_TO
214
- if @message.to == cond.value
215
- reason = "condition to = #{cond.value}"
216
- end
217
- end
202
+ filter.conditions.each do |scond|
203
+ reason ||= scond.apply(leadset: leadset, message: @message )
218
204
  end
219
205
 
220
206
  if reason
@@ -229,6 +215,10 @@ class WcoEmail::MessageStub
229
215
  skip_reason = 'skip_from_regex'
230
216
  end
231
217
 
218
+ filter.skip_conditions.each do |scond|
219
+ skip_reason ||= scond.apply(leadset: leadset, message: @message )
220
+ end
221
+
232
222
  if skip_reason
233
223
  puts! "NOT Applying filter #{filter} to conv #{@message.conversation} for matching #{skip_reason}" if DEBUG
234
224
  else
@@ -26,6 +26,10 @@
26
26
  -# %label Stripe customer_id
27
27
  -# = f.text_field :customer_id
28
28
 
29
+ .field
30
+ %label tags
31
+ = f.select :tag_ids, options_for_select(@tags_list, selected: leadset.tag_ids), {}, { multiple: true }
32
+
29
33
  .actions
30
34
  = f.submit
31
35
 
@@ -33,9 +33,7 @@
33
33
  = link_to leadset.company_url, leadset_path(leadset)
34
34
 
35
35
  %td.tags
36
- - leadset.tags.each_with_index do |tag, idx2|
37
- .chip
38
- = tag.name
36
+ = render '/wco/tags/index_chips', tags: leadset.tags
39
37
 
40
38
  %td.leads
41
39
  = leadset.leads.length
@@ -81,7 +81,10 @@
81
81
  %hr
82
82
 
83
83
  .row
84
- .col-12
84
+ .col-6
85
85
  %h5.collapse-expand#leads Leads
86
86
  = render '/wco/leads/index', leads: @leads
87
+ .col-6
88
+ Tags:
89
+ = render '/wco/tags/index_chips', tags: @leadset.tags
87
90
 
@@ -9,6 +9,8 @@
9
9
  %label Slug
10
10
  = f.text_field :slug, class: 'w-100'
11
11
 
12
+ .descr
13
+ available vars: @conversations , @oat ,
12
14
  .field
13
15
  %label action_exe
14
16
  = f.text_area :action_exe, class: :monospace
@@ -8,6 +8,15 @@ namespace :db do
8
8
  leadset.persisted?
9
9
  lead = Wco::Lead.find_or_create_by({ email: 'poxlovi@gmail.com', leadset: leadset })
10
10
  lead.persisted?
11
+
12
+ blank_email_template = WcoEmail::EmailTemplate.find_or_create_by({ slug: 'blank' })
13
+ blank_email_template.persisted?
14
+
15
+ Wco::Tag.inbox
16
+ Wco::Tag.trash
17
+ Wco::Tag.spam
18
+ Wco::Tag.not_spam
19
+
11
20
  end
12
21
 
13
22
  end
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.192
4
+ version: 3.1.0.194
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-21 00:00:00.000000000 Z
11
+ date: 2025-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ahoy_matey