[minor] minor fixes for email inbox and imap sync
This commit is contained in:
parent
6839c145f6
commit
1d272da47f
3 changed files with 10 additions and 11 deletions
|
|
@ -142,7 +142,8 @@ class EmailAccount(Document):
|
|||
"username": getattr(self, "login_id", None) or self.email_id,
|
||||
"use_imap": self.use_imap,
|
||||
"email_sync_rule": email_sync_rule,
|
||||
"uid_validity": self.uidvalidity
|
||||
"uid_validity": self.uidvalidity,
|
||||
"initial_sync_count": self.initial_sync_count or 100
|
||||
})
|
||||
|
||||
if self.password:
|
||||
|
|
@ -251,8 +252,9 @@ class EmailAccount(Document):
|
|||
|
||||
for idx, msg in enumerate(incoming_mails):
|
||||
try:
|
||||
uid = None if not uid_list else uid_list[idx]
|
||||
args = {
|
||||
"uid": None if not uid_list else uid_list[idx],
|
||||
"uid": uid,
|
||||
"seen": None if not seen_status else get_seen(seen_status.get(uid, None)),
|
||||
"fingerprint": None if not fingerprint_list else fingerprint_list.get(uid, None),
|
||||
"uid_reindexed": uid_reindexed
|
||||
|
|
@ -310,8 +312,8 @@ class EmailAccount(Document):
|
|||
raw = msg
|
||||
seen = uid = None
|
||||
|
||||
if args.get("uid", None): uid = _uid
|
||||
if args.get("seen", None): seen = _seen
|
||||
if args.get("uid", None): uid = args.get("uid", None)
|
||||
if args.get("seen", None): seen = args.get("seen", None)
|
||||
|
||||
email = Email(raw)
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ frappe.Inbox = frappe.ui.Listing.extend({
|
|||
start: 0,
|
||||
show_filters: true
|
||||
});
|
||||
this.filter_list.add_filter("Communication", "deleted", "=", "No");
|
||||
|
||||
this.render_headers();
|
||||
this.render_footer();
|
||||
this.run();
|
||||
|
|
@ -140,7 +140,7 @@ frappe.Inbox = frappe.ui.Listing.extend({
|
|||
["Communication", "sent_or_received", "=", "Received"]];
|
||||
}
|
||||
me.filter_list.clear_filters();
|
||||
me.filter_list.add_filter("Communication", "deleted", "=", "No");
|
||||
|
||||
if (me.filter_list.reload_stats){me.filter_list.reload_stats()}
|
||||
me.refresh();
|
||||
});
|
||||
|
|
@ -153,7 +153,7 @@ frappe.Inbox = frappe.ui.Listing.extend({
|
|||
doctype: this.doctype,
|
||||
fields:["name", "sender", "sender_full_name", "communication_date", "recipients", "cc","communication_medium",
|
||||
"subject", "status" ,"reference_doctype", "reference_name", "timeline_doctype", "timeline_name",
|
||||
"timeline_label", "sent_or_received", "uid", "message_id", "seen", "nomatch", "has_attachment"],
|
||||
"timeline_label", "sent_or_received", "uid", "message_id", "seen"],
|
||||
filters: this.filter_list.get_filters(),
|
||||
order_by: 'communication_date desc',
|
||||
save_list_settings: false
|
||||
|
|
@ -581,9 +581,6 @@ frappe.Inbox = frappe.ui.Listing.extend({
|
|||
} else {
|
||||
var names = [{name:data.name, uid:data.uid}]
|
||||
}
|
||||
//could add flag to sync deletes but not going to as keeps history
|
||||
|
||||
me.update_local_flags(names, "deleted", "1")
|
||||
},
|
||||
mark_unread:function(){
|
||||
var me = this;
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ class EmailServer:
|
|||
email_account=self.settings.email_account)
|
||||
)
|
||||
|
||||
sync_count = 100 if uid_validity else self.settings.initial_sync_count
|
||||
sync_count = 100 if uid_validity else int(self.settings.initial_sync_count)
|
||||
from_uid = 1 if uidnext < (sync_count + 1) or (uidnext - sync_count) < 1 else uidnext - sync_count
|
||||
# sync last 100 email
|
||||
self.settings.email_sync_rule = "UID {}:{}".format(from_uid, uidnext)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue