ish_models 0.0.33.296 → 0.0.33.298

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: d06c52c4c68b449a8416eedfeb0da3aa210cc2e097bbbfc63a6436b9f1923522
4
- data.tar.gz: 6b44f5a057acc1b6e47ac749e0019aacd482735a530d34265c5dd112cb7b47da
3
+ metadata.gz: 6efbb3c5c1034605f73ba6a4f56764e19fade25ba178072bcbdaf6527bcee7f4
4
+ data.tar.gz: aede88c5c6e113884d13f5b8bdeb243509d5cc824d3decbe4a3bf16384900cd1
5
5
  SHA512:
6
- metadata.gz: 5b9564338cf5c8897e5fae2ffb0d053f6b3308edd080cb19f6ddd56ef92422db7984745cea0b141d9d76f82691437078251e7a92b50776854d41aeb2add8ce2a
7
- data.tar.gz: 958c4ab9ae95202a172496651ba9ea5f8b6a0992cd3809a8a5e2f8827a3944cbf8edb8025a72ea3f8c2d5a9e40e7e2677735cdefc87b8473fb4518c86be0ff0a
6
+ metadata.gz: 570ceaa54fada7bf9740eb8e7a0101b56942d1c0d65e59e35199ba42e9e3891a5ba8456d47e1eadc56e54488fd3584f0c854b72aa9b4d2e8cb33812fe6052f08
7
+ data.tar.gz: a54d2878d3b3e90a1d891d7485c18ca6f884fb32f46a47f13052eeea959aceebc129edc28ac3022cab0299a4cc9cfd87989a3081a99e87ee92aca1148962c86b
@@ -18,6 +18,8 @@ class Office::EmailConversation
18
18
  field :from_emails, type: :array, default: []
19
19
  index({ from_emails: -1 })
20
20
 
21
+ field :preview, default: ''
22
+
21
23
  has_many :lead_ties, class_name: 'Office::EmailConversationLead'
22
24
  # def lead_ids
23
25
  # email_conversation_leads.map( &:lead_id )
@@ -9,6 +9,9 @@ class Office::EmailMessage
9
9
  include Mongoid::Timestamps
10
10
 
11
11
  field :raw, type: :string
12
+ def the_mail
13
+ Mail.new( raw )
14
+ end
12
15
 
13
16
  field :message_id, type: :string # MESSAGE-ID
14
17
  validates_uniqueness_of :message_id
@@ -21,11 +24,8 @@ class Office::EmailMessage
21
24
  field :object_path, type: :string ## A routable s3 url
22
25
 
23
26
  field :subject
24
- field :part_txt
25
27
  field :part_html
26
- field :preamble
27
- field :epilogue
28
-
28
+ field :part_txt
29
29
 
30
30
  def lead
31
31
  Lead.find_by email: from
@@ -37,6 +37,7 @@ class Office::EmailMessage
37
37
  field :tos, type: Array, default: []
38
38
  field :cc, type: :string
39
39
  field :ccs, type: Array, default: []
40
+ def all_ccs; (tos||[]) + (ccs||[]) + (froms||[]); end
40
41
  field :bcc, type: :string
41
42
  field :bccs, type: Array, default: []
42
43
 
@@ -55,12 +56,6 @@ class Office::EmailMessage
55
56
  has_many :email_attachments, class_name: 'Office::EmailAttachment', inverse_of: :email_message
56
57
  has_many :attachments, class_name: 'Photo'
57
58
 
58
- def preview_str
59
- body = part_html || part_html || 'Neither part_html nor part_txt!'
60
- body = ::ActionView::Base.full_sanitizer.sanitize( body ).gsub(/\s+/, ' ')
61
- body = body[0..200]
62
- body
63
- end
64
59
 
65
60
 
66
61
  def apply_filter filter
@@ -179,6 +174,14 @@ class Office::EmailMessage
179
174
  end
180
175
 
181
176
 
177
+ def body_sanitized
178
+ ActionView::Base.full_sanitizer.sanitize( part_html||'' ).squish
179
+ end
180
+ def preview_str
181
+ body_sanitized[0..200]
182
+ end
183
+
184
+
182
185
  end
183
186
  ::Msg = Office::EmailMessage
184
187
 
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.296
4
+ version: 0.0.33.298
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox