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 +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: 9b50c2d5f3c7332ce08f7a0370514bfaa1f9f28c05df96be4cabe293392c30a3
|
4
|
+
data.tar.gz: 84b3e52133ab4dcdda7cc1433350352319ef30e5d79d806d2125924eeb4981a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 )
|
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
|
|