Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / mailMessage / mailMessage.model.js
index 0d2fc50..7434c69 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xede8=['moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xede8,0xe4));var _0x8ede=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xede8[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x8ede('0x0'));var logger=require(_0x8ede('0x1'))(_0x8ede('0x2'));var moment=require(_0x8ede('0x3'));var BPromise=require(_0x8ede('0x4'));var rp=require(_0x8ede('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x8ede('0x6'));var rimraf=require(_0x8ede('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ede('0x8'));module['exports']=function(_0x5332df,_0x5bcf2f){return _0x5332df[_0x8ede('0x9')](_0x8ede('0xa'),attributes,{'tableName':_0x8ede('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x8ede('0xc'),_0x8ede('0xd')],'type':_0x8ede('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x107afe,_0x1a3ff6,_0x5f0fd0){if(_0x107afe[_0x8ede('0xf')]){_0x107afe[_0x8ede('0xc')]=htmlToText[_0x8ede('0x10')](_0x107afe[_0x8ede('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5f0fd0(null,_0x1a3ff6);},'afterCreate':function(_0x518cf4,_0x4f9262,_0x278b7f){var _0x2042e6=_0x5332df[_0x8ede('0x11')];var _0x5b4e2b=_0x518cf4[_0x8ede('0x12')]({'plain':!![]});if(_0x5b4e2b[_0x8ede('0x13')]['toLowerCase']()==='in'||_0x5b4e2b[_0x8ede('0x13')][_0x8ede('0x14')]()===_0x8ede('0x15')&&!_0x5b4e2b[_0x8ede('0x16')]&&!_[_0x8ede('0x17')](_0x5b4e2b[_0x8ede('0x18')])){_0x2042e6[_0x8ede('0x19')]['findOne']({'where':{'id':_0x5b4e2b[_0x8ede('0x1a')]}})[_0x8ede('0x1b')](function(_0x307a60){if(_0x307a60){_0x307a60[_0x8ede('0x1c')]({'lastMsgAt':_0x5b4e2b['createdAt'],'lastMsgDirection':_0x5b4e2b[_0x8ede('0x13')][_0x8ede('0x14')](),'lastMsgBody':_0x5b4e2b[_0x8ede('0xf')]});}})[_0x8ede('0x1d')](function(_0xafc406){console[_0x8ede('0x1e')](_0xafc406);});}_0x278b7f();}},'charset':_0x8ede('0x1f'),'collate':_0x8ede('0x20')});};
\ No newline at end of file
+var _0x0d76=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','get','direction','toLowerCase','out','isNil','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4'];(function(_0xd6c010,_0x5355e6){var _0x15893b=function(_0x1b0a5a){while(--_0x1b0a5a){_0xd6c010['push'](_0xd6c010['shift']());}};_0x15893b(++_0x5355e6);}(_0x0d76,0x78));var _0x60d7=function(_0x218c39,_0x31de32){_0x218c39=_0x218c39-0x0;var _0x100e20=_0x0d76[_0x218c39];return _0x100e20;};'use strict';var _=require(_0x60d7('0x0'));var util=require(_0x60d7('0x1'));var logger=require('../../config/logger')(_0x60d7('0x2'));var moment=require(_0x60d7('0x3'));var BPromise=require(_0x60d7('0x4'));var rp=require(_0x60d7('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x60d7('0x6'));var rimraf=require(_0x60d7('0x7'));var config=require(_0x60d7('0x8'));var attributes=require(_0x60d7('0x9'));module['exports']=function(_0x1b2fc6,_0x229c4e){return _0x1b2fc6[_0x60d7('0xa')](_0x60d7('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x60d7('0xc'),'fields':[_0x60d7('0xc')]},{'name':_0x60d7('0xd'),'fields':[_0x60d7('0xe'),_0x60d7('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36e9fc,_0x1c164a,_0x14df5c){if(_0x36e9fc[_0x60d7('0x10')]){_0x36e9fc[_0x60d7('0xe')]=htmlToText['fromString'](_0x36e9fc[_0x60d7('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x14df5c(null,_0x1c164a);},'afterCreate':function(_0x3f8ab0,_0x592521,_0x35655c){var _0x468aa7=_0x1b2fc6['models'];var _0x3a744b=_0x3f8ab0[_0x60d7('0x11')]({'plain':!![]});if(_0x3a744b[_0x60d7('0x12')]['toLowerCase']()==='in'||_0x3a744b[_0x60d7('0x12')][_0x60d7('0x13')]()===_0x60d7('0x14')&&!_0x3a744b['secret']&&!_[_0x60d7('0x15')](_0x3a744b['UserId'])){_0x468aa7[_0x60d7('0x16')][_0x60d7('0x17')]({'where':{'id':_0x3a744b['MailInteractionId']}})[_0x60d7('0x18')](function(_0x44cdbb){if(_0x44cdbb){_0x44cdbb[_0x60d7('0x19')]({'lastMsgAt':_0x3a744b[_0x60d7('0x1a')],'lastMsgDirection':_0x3a744b['direction'][_0x60d7('0x13')]()});}})[_0x60d7('0x1b')](function(_0x35db69){console[_0x60d7('0x1c')](_0x35db69);});}_0x35655c();}},'charset':_0x60d7('0x1d'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file