ish_models 0.0.33.295 → 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/ish/email_template.rb +3 -1
- data/lib/office/email_conversation.rb +2 -0
- data/lib/office/email_message.rb +21 -16
- 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
|
data/lib/ish/email_template.rb
CHANGED
@@ -40,6 +40,8 @@ class ::Ish::EmailTemplate
|
|
40
40
|
'DemmiTV <hello@demmi.tv>',
|
41
41
|
'DemmiTV <no-reply@demmi.tv>',
|
42
42
|
|
43
|
+
'Victor Pudeyev <victor@fedfis.com>',
|
44
|
+
|
43
45
|
'Infinite Shelter <hello@infiniteshelter.com>',
|
44
46
|
'Infinite Shelter <no-reply@infiniteshelter.com>',
|
45
47
|
|
@@ -84,7 +86,7 @@ class ::Ish::EmailTemplate
|
|
84
86
|
<div><br></div>
|
85
87
|
<div>Regards,</div>
|
86
88
|
<div>-=----- >8 --</div>
|
87
|
-
<div>Victor Pudeyev<br>Director of Engineering<br><a href="mailto:victor@
|
89
|
+
<div>Victor Pudeyev<br>Director of Engineering<br><a href="mailto:victor@wasya.co" target="_blank">victor@wasya.co</a> | <a href="https://tidycal.com/wasya-co/30min" target="_blank">Book a chat</a><br></div>
|
88
90
|
</div><hr /><br /><br /><br />
|
89
91
|
AOL
|
90
92
|
|
@@ -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,9 +37,12 @@ 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
|
|
44
|
+
field :logs, type: Array, default: []
|
45
|
+
|
43
46
|
field :date, type: DateTime
|
44
47
|
def received_at
|
45
48
|
date
|
@@ -53,12 +56,6 @@ class Office::EmailMessage
|
|
53
56
|
has_many :email_attachments, class_name: 'Office::EmailAttachment', inverse_of: :email_message
|
54
57
|
has_many :attachments, class_name: 'Photo'
|
55
58
|
|
56
|
-
def preview_str
|
57
|
-
body = part_html || part_html || 'Neither part_html nor part_txt!'
|
58
|
-
body = ::ActionView::Base.full_sanitizer.sanitize( body ).gsub(/\s+/, ' ')
|
59
|
-
body = body[0..200]
|
60
|
-
body
|
61
|
-
end
|
62
59
|
|
63
60
|
|
64
61
|
def apply_filter filter
|
@@ -146,12 +143,12 @@ class Office::EmailMessage
|
|
146
143
|
churn_subpart( subpart )
|
147
144
|
end
|
148
145
|
else
|
149
|
-
attachment = Office::EmailAttachment.new({
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
})
|
154
|
-
attachment.save
|
146
|
+
# attachment = Office::EmailAttachment.new({
|
147
|
+
# content: part.decoded,
|
148
|
+
# content_type: part.content_type,
|
149
|
+
# email_message: self,
|
150
|
+
# })
|
151
|
+
# attachment.save
|
155
152
|
|
156
153
|
if part.content_type.include?('text/html')
|
157
154
|
part_html = part.decoded
|
@@ -177,6 +174,14 @@ class Office::EmailMessage
|
|
177
174
|
end
|
178
175
|
|
179
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
|
+
|
180
185
|
end
|
181
186
|
::Msg = Office::EmailMessage
|
182
187
|
|