ish_models 0.0.33.296 → 0.0.33.297

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: 9b50c2d5f3c7332ce08f7a0370514bfaa1f9f28c05df96be4cabe293392c30a3
4
+ data.tar.gz: 84b3e52133ab4dcdda7cc1433350352319ef30e5d79d806d2125924eeb4981a5
5
5
  SHA512:
6
- metadata.gz: 5b9564338cf5c8897e5fae2ffb0d053f6b3308edd080cb19f6ddd56ef92422db7984745cea0b141d9d76f82691437078251e7a92b50776854d41aeb2add8ce2a
7
- data.tar.gz: 958c4ab9ae95202a172496651ba9ea5f8b6a0992cd3809a8a5e2f8827a3944cbf8edb8025a72ea3f8c2d5a9e40e7e2677735cdefc87b8473fb4518c86be0ff0a
6
+ metadata.gz: 00d336c20641040168dc13f87574fd9d8edcf8cfad12446b41caddedb6da5cea73043be709d6a7682e774ef14352e792e629645475b13434993fb634456d8ee2
7
+ data.tar.gz: 55e0a1eca6a8115331e539ced6ac2bda15c7e6ed8528b6ec7aef394d82b5b3f62699342f87656c0bf0b95508199cc1c49acc4901ce7f0f60eb7188cf5f4dc1f4
@@ -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.297
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox