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 +4 -4
- data/lib/office/email_conversation.rb +2 -0
- data/lib/office/email_message.rb +13 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6efbb3c5c1034605f73ba6a4f56764e19fade25ba178072bcbdaf6527bcee7f4
|
4
|
+
data.tar.gz: aede88c5c6e113884d13f5b8bdeb243509d5cc824d3decbe4a3bf16384900cd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 )
|
data/lib/office/email_message.rb
CHANGED
@@ -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 :
|
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
|
|