@dhyasama/totem-models 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Message.js +14 -0
- package/package.json +1 -1
package/lib/Message.js
CHANGED
|
@@ -35,6 +35,20 @@ module.exports = function(mongoose, config) {
|
|
|
35
35
|
|
|
36
36
|
///////////////////////////////////////
|
|
37
37
|
|
|
38
|
+
Message.virtual('messageDate').get(function () {
|
|
39
|
+
|
|
40
|
+
// A little helper to get the message date since
|
|
41
|
+
// the original message date isn't always contained
|
|
42
|
+
// in the email. In its absence, use created on.
|
|
43
|
+
|
|
44
|
+
var self = this;
|
|
45
|
+
|
|
46
|
+
return self.originalMessageDate || self.createdOn;
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
///////////////////////////////////////
|
|
51
|
+
|
|
38
52
|
Message.statics.addDocument = function(messageId, doc, cb) {
|
|
39
53
|
|
|
40
54
|
Document.createForModel(doc, this, messageId, cb);
|