Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
仰若水
frappe
Commits
2ce0f70c
Commit
2ce0f70c
authored
7 years ago
by
Nabin Hait
Browse files
Options
Download
Plain Diff
Merge branch 'hotfix'
parents
79787d0e
552abc9d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
frappe/__init__.py
+1
-1
frappe/__init__.py
frappe/core/doctype/communication/communication.py
+2
-3
frappe/core/doctype/communication/communication.py
frappe/core/doctype/communication/communication_list.js
+3
-3
frappe/core/doctype/communication/communication_list.js
frappe/core/doctype/communication/email.py
+3
-0
frappe/core/doctype/communication/email.py
frappe/email/doctype/email_flag_queue/email_flag_queue.json
+6
-30
frappe/email/doctype/email_flag_queue/email_flag_queue.json
frappe/email/inbox.py
+26
-20
frappe/email/inbox.py
frappe/public/js/frappe/ui/base_list.js
+1
-1
frappe/public/js/frappe/ui/base_list.js
frappe/public/js/frappe/ui/field_group.js
+6
-6
frappe/public/js/frappe/ui/field_group.js
frappe/website/js/web_form.js
+6
-3
frappe/website/js/web_form.js
with
54 additions
and
67 deletions
+54
-67
frappe/__init__.py
View file @
2ce0f70c
...
...
@@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json
from
.exceptions
import
*
from
.utils.jinja
import
get_jenv
,
get_template
,
render_template
,
get_email_from_template
__version__
=
'8.10.
8
'
__version__
=
'8.10.
9
'
__title__
=
"Frappe Framework"
local
=
Local
()
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/communication.py
View file @
2ce0f70c
...
...
@@ -26,17 +26,16 @@ class Communication(Document):
if
self
.
communication_type
==
"Communication"
and
self
.
communication_medium
==
"Email"
\
and
self
.
sent_or_received
==
"Received"
and
self
.
uid
and
self
.
uid
!=
-
1
:
flag
=
frappe
.
db
.
get_value
(
"Email Flag Queue"
,
{
email_flag_queue
=
frappe
.
db
.
get_value
(
"Email Flag Queue"
,
{
"communication"
:
self
.
name
,
"is_completed"
:
0
})
if
flag
:
if
email_flag_queue
:
return
frappe
.
get_doc
({
"doctype"
:
"Email Flag Queue"
,
"action"
:
"Read"
,
"communication"
:
self
.
name
,
"flag"
:
"(
\\
SEEN)"
,
"uid"
:
self
.
uid
,
"email_account"
:
self
.
email_account
}).
insert
(
ignore_permissions
=
True
)
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/communication_list.js
View file @
2ce0f70c
...
...
@@ -9,13 +9,13 @@ frappe.listview_settings['Communication'] = {
filters
:
[[
"
status
"
,
"
=
"
,
"
Open
"
]],
onload
:
function
(
list_view
)
{
var
method
=
"
frappe.email.inbox.create_email_flag_queue
"
let
method
=
"
frappe.email.inbox.create_email_flag_queue
"
list_view
.
page
.
add_menu_item
(
__
(
"
Mark as Read
"
),
function
()
{
list_view
.
call_for_selected_items
(
method
,
{
action
:
"
Read
"
})
list_view
.
call_for_selected_items
(
method
,
{
action
:
"
Read
"
})
;
});
list_view
.
page
.
add_menu_item
(
__
(
"
Mark as Unread
"
),
function
()
{
list_view
.
call_for_selected_items
(
method
,
{
action
:
"
Unread
"
})
list_view
.
call_for_selected_items
(
method
,
{
action
:
"
Unread
"
})
;
});
},
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/email.py
View file @
2ce0f70c
...
...
@@ -289,6 +289,9 @@ def set_incoming_outgoing_accounts(doc):
{
"default_outgoing"
:
1
,
"enable_outgoing"
:
1
},
[
"email_id"
,
"always_use_account_email_id_as_sender"
,
"name"
,
"send_unsubscribe_message"
],
as_dict
=
True
)
or
frappe
.
_dict
()
if
doc
.
sent_or_received
==
"Sent"
:
doc
.
db_set
(
"email_account"
,
doc
.
outgoing_email_account
.
name
)
def
get_recipients
(
doc
,
fetched_from_email_account
=
False
):
"""Build a list of email addresses for To"""
# [EDGE CASE] doc.recipients can be None when an email is sent as BCC
...
...
This diff is collapsed.
Click to expand it.
frappe/email/doctype/email_flag_queue/email_flag_queue.json
View file @
2ce0f70c
...
...
@@ -12,6 +12,7 @@
"editable_grid"
:
0
,
"fields"
:
[
{
"allow_bulk_edit"
:
0
,
"allow_on_submit"
:
0
,
"bold"
:
0
,
"collapsible"
:
0
,
...
...
@@ -41,6 +42,7 @@
"unique"
:
0
},
{
"allow_bulk_edit"
:
0
,
"allow_on_submit"
:
0
,
"bold"
:
0
,
"collapsible"
:
0
,
...
...
@@ -71,6 +73,7 @@
"unique"
:
0
},
{
"allow_bulk_edit"
:
0
,
"allow_on_submit"
:
0
,
"bold"
:
0
,
"collapsible"
:
0
,
...
...
@@ -101,35 +104,7 @@
"unique"
:
0
},
{
"allow_on_submit"
:
0
,
"bold"
:
0
,
"collapsible"
:
0
,
"columns"
:
0
,
"fieldname"
:
"flag"
,
"fieldtype"
:
"Data"
,
"hidden"
:
0
,
"ignore_user_permissions"
:
0
,
"ignore_xss_filter"
:
0
,
"in_filter"
:
0
,
"in_global_search"
:
0
,
"in_list_view"
:
0
,
"in_standard_filter"
:
0
,
"label"
:
"Flag"
,
"length"
:
0
,
"no_copy"
:
0
,
"permlevel"
:
0
,
"precision"
:
""
,
"print_hide"
:
0
,
"print_hide_if_no_value"
:
0
,
"read_only"
:
0
,
"remember_last_selected_value"
:
0
,
"report_hide"
:
0
,
"reqd"
:
0
,
"search_index"
:
0
,
"set_only_once"
:
0
,
"unique"
:
0
},
{
"allow_bulk_edit"
:
0
,
"allow_on_submit"
:
0
,
"bold"
:
0
,
"collapsible"
:
0
,
...
...
@@ -159,6 +134,7 @@
"unique"
:
0
},
{
"allow_bulk_edit"
:
0
,
"allow_on_submit"
:
0
,
"bold"
:
0
,
"collapsible"
:
0
,
...
...
@@ -198,7 +174,7 @@
"issingle"
:
0
,
"istable"
:
0
,
"max_attachments"
:
0
,
"modified"
:
"2017-0
3-15 13:09:28.002266
"
,
"modified"
:
"2017-0
9-20 15:27:12.142079
"
,
"modified_by"
:
"Administrator"
,
"module"
:
"Email"
,
"name"
:
"Email Flag Queue"
,
...
...
This diff is collapsed.
Click to expand it.
frappe/email/inbox.py
View file @
2ce0f70c
...
...
@@ -46,48 +46,54 @@ def get_email_accounts(user=None):
}
@
frappe
.
whitelist
()
def
create_email_flag_queue
(
names
,
action
,
flag
=
"(
\\
Seen)"
):
def
create_email_flag_queue
(
names
,
action
):
""" create email flag queue to mark email either as read or unread """
class
Found
(
Exception
):
pass
if
not
all
([
names
,
action
,
flag
]):
def
mark_as_seen_unseen
(
name
,
action
):
doc
=
frappe
.
get_doc
(
"Communication"
,
name
)
if
action
==
"Read"
:
doc
.
add_seen
()
else
:
_seen
=
json
.
loads
(
doc
.
_seen
or
'[]'
)
_seen
=
[
user
for
user
in
_seen
if
frappe
.
session
.
user
!=
user
]
doc
.
db_set
(
'_seen'
,
json
.
dumps
(
_seen
),
update_modified
=
False
)
if
not
all
([
names
,
action
]):
return
for
name
in
json
.
loads
(
names
or
[]):
uid
,
seen_status
,
email_account
=
frappe
.
db
.
get_value
(
"Communication"
,
name
,
[
"ifnull(uid, -1)"
,
"ifnull(seen, 0)"
,
"email_account"
])
# can not mark email SEEN or UNSEEN without uid
if
not
uid
or
uid
==
-
1
:
continue
seen
=
1
if
action
==
"Read"
else
0
# check if states are correct
if
(
action
==
'Read'
and
seen_status
==
0
)
or
(
action
==
'Unread'
and
seen_status
==
1
):
try
:
queue
=
frappe
.
db
.
sql
(
"""select name, action, flag from `tabEmail Flag Queue`
where communication = %(name)s"""
,
{
"name"
:
name
},
as_dict
=
True
)
for
q
in
queue
:
# is same email with same flag
if
q
.
flag
==
flag
:
# to prevent flag local and server states being out of sync
if
q
.
action
!=
action
:
frappe
.
delete_doc
(
"Email Flag Queue"
,
q
.
name
)
raise
Found
create_new
=
True
email_flag_queue
=
frappe
.
db
.
sql
(
"""select name, action from `tabEmail Flag Queue`
where communication = %(name)s and is_completed=0"""
,
{
"name"
:
name
},
as_dict
=
True
)
for
queue
in
email_flag_queue
:
if
queue
.
action
!=
action
:
frappe
.
delete_doc
(
"Email Flag Queue"
,
queue
.
name
,
ignore_permissions
=
True
)
elif
queue
.
action
==
action
:
# Read or Unread request for email is already available
create_new
=
False
if
create_new
:
flag_queue
=
frappe
.
get_doc
({
"uid"
:
uid
,
"flag"
:
flag
,
"action"
:
action
,
"communication"
:
name
,
"doctype"
:
"Email Flag Queue"
,
"email_account"
:
email_account
})
flag_queue
.
save
(
ignore_permissions
=
True
)
;
flag_queue
.
save
(
ignore_permissions
=
True
)
frappe
.
db
.
set_value
(
"Communication"
,
name
,
"seen"
,
seen
,
update_modified
=
False
)
except
Found
:
pass
mark_as_seen_unseen
(
name
,
action
)
@
frappe
.
whitelist
()
def
mark_as_trash
(
communication
):
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/ui/base_list.js
View file @
2ce0f70c
...
...
@@ -524,7 +524,7 @@ frappe.ui.BaseList = Class.extend({
if
(
me
.
list_header
)
{
me
.
list_header
.
find
(
"
.list-select-all
"
).
prop
(
"
checked
"
,
false
);
}
me
.
refresh
();
me
.
refresh
(
true
);
}
}
});
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/ui/field_group.js
View file @
2ce0f70c
...
...
@@ -32,13 +32,13 @@ frappe.ui.FieldGroup = frappe.ui.form.Layout.extend({
this
.
catch_enter_as_submit
();
}
$
(
this
.
body
).
find
(
'
input
'
).
on
(
'
change
'
,
function
()
{
me
.
refresh_dependency
();
})
$
(
this
.
body
).
find
(
'
input, select
'
).
on
(
'
change
'
,
function
()
{
frappe
.
run_serially
([
()
=>
frappe
.
timeout
(
0.1
),
()
=>
me
.
refresh_dependency
()
]);
});
$
(
this
.
body
).
find
(
'
select
'
).
on
(
"
change
"
,
function
()
{
me
.
refresh_dependency
();
})
}
},
add_fields
:
function
(
fields
)
{
...
...
This diff is collapsed.
Click to expand it.
frappe/website/js/web_form.js
View file @
2ce0f70c
...
...
@@ -350,7 +350,7 @@ frappe.ready(function() {
}
});
}
})
})
;
// setup datepicker in all inputs within the given element
var
setup_date_picker
=
function
(
ele
)
{
...
...
@@ -362,7 +362,10 @@ frappe.ready(function() {
$dates
.
datepicker
({
language
:
"
en
"
,
autoClose
:
true
,
dateFormat
:
frappe
.
datepicker_format
dateFormat
:
frappe
.
datepicker_format
,
onSelect
:
function
(
date
,
date_str
,
e
)
{
e
.
$el
.
trigger
(
'
change
'
);
},
});
// initialize dates from YYYY-MM-DD to user format
...
...
@@ -408,7 +411,7 @@ frappe.ready(function() {
});
});
}
}
;
setup_text_editor
();
});
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help