diff --git a/public/js/wn/views/communication.js b/public/js/wn/views/communication.js index 40a4375747..2dfa40cc45 100644 --- a/public/js/wn/views/communication.js +++ b/public/js/wn/views/communication.js @@ -75,7 +75,7 @@ wn.views.CommunicationList = Class.extend({ make_line: function(doc) { var me = this; var comm = $(repl('\ - ' + ' +wn._('Show Details')+'\

\ %(_sender)s on %(when)s

\ @@ -83,6 +83,10 @@ wn.views.CommunicationList = Class.extend({ padding: 10px; overflow-x: auto; display: none;">\ ', doc)) .appendTo(this.body); + + if(!doc.name) { + comm.find(".show-details").toggle(false); + } comm.find(".comm-header") .css({"cursor":"pointer"}) diff --git a/webnotes/model/wrapper.py b/webnotes/model/wrapper.py index 81d79a633a..8011c78444 100644 --- a/webnotes/model/wrapper.py +++ b/webnotes/model/wrapper.py @@ -48,6 +48,8 @@ class ModelWrapper: self.load_from_db(dt, dn) elif isinstance(dt, list): self.set_doclist(dt) + elif isinstance(dt, dict): + self.set_doclist([dt]) def load_from_db(self, dt=None, dn=None, prefix='tab'): """ diff --git a/webnotes/utils/email_lib/receive.py b/webnotes/utils/email_lib/receive.py index 8d0248e9f0..a5f1e1719f 100644 --- a/webnotes/utils/email_lib/receive.py +++ b/webnotes/utils/email_lib/receive.py @@ -100,30 +100,27 @@ class IncomingMail: def get_thread_id(self): import re subject = self.mail.get('Subject', '') - return re.findall('(?<=\[)[\w/-]+', subject) + l= re.findall('(?<=\[)[\w/-]+', subject) + return l and l[0] or None class POP3Mailbox: - """ - A simple pop3 mailbox, abstracts connection and mail extraction - To use, subclass it and override method process_message(from, subject, text, thread_id) - """ + def __init__(self): + self.setup() + self.get_messages() - def __init__(self, settings_doc): - """ - settings_doc must contain - use_ssl, host, username, password - (by name or object) - """ - if isinstance(settings_doc, basestring): - from webnotes.model.doc import Document - self.settings = Document(settings_doc, settings_doc) - else: - self.settings = settings_doc + def setup(self): + # overrride + self.settings = webnotes._dict() + def check_mails(self): + # overrride + return True + + def process_message(self, mail): + # overrride + pass + def connect(self): - """ - Connects to the mailbox - """ import poplib if self.settings.use_ssl: @@ -134,10 +131,6 @@ class POP3Mailbox: self.pop.pass_(self.settings.password) def get_messages(self): - """ - Loads messages from the mailbox and calls - process_message for each message - """ import webnotes if not self.check_mails(): @@ -179,15 +172,3 @@ class POP3Mailbox: self.pop.quit() webnotes.conn.begin() - def check_mails(self): - """ - To be overridden - If mailbox is to be scanned, returns true - """ - return True - - def process_message(self, mail): - """ - To be overriden - """ - pass