fix: codacy
This commit is contained in:
parent
ab8d00a5b7
commit
bb46bb0fa7
2 changed files with 20 additions and 20 deletions
|
|
@ -54,13 +54,13 @@ def make_notification_logs(doc, users):
|
|||
if is_notifications_enabled(user):
|
||||
if doc.type == 'Energy Point' and not is_energy_point_enabled():
|
||||
return
|
||||
else:
|
||||
_doc = frappe.new_doc('Notification Log')
|
||||
_doc.update(doc)
|
||||
_doc.for_user = user
|
||||
_doc.subject = _doc.subject.replace('<div>', '').replace('</div>', '')
|
||||
if _doc.for_user != _doc.from_user or doc.type == 'Energy Point':
|
||||
_doc.insert(ignore_permissions=True)
|
||||
|
||||
_doc = frappe.new_doc('Notification Log')
|
||||
_doc.update(doc)
|
||||
_doc.for_user = user
|
||||
_doc.subject = _doc.subject.replace('<div>', '').replace('</div>', '')
|
||||
if _doc.for_user != _doc.from_user or doc.type == 'Energy Point':
|
||||
_doc.insert(ignore_permissions=True)
|
||||
|
||||
def send_notification_email(doc):
|
||||
is_type_enabled = is_email_notifications_enabled_for_type(doc.for_user, doc.type)
|
||||
|
|
@ -114,8 +114,8 @@ def get_title_html(title):
|
|||
@frappe.whitelist()
|
||||
def set_all_values_for_field(docnames, fieldname):
|
||||
docnames = frappe.parse_json(docnames)
|
||||
event_name = 'all_' + fieldname
|
||||
if docnames:
|
||||
event_name = 'all_' + fieldname
|
||||
if docnames:
|
||||
filters = {'name': ['in', docnames]}
|
||||
frappe.db.set_value('Notification Log', filters, fieldname, 1, update_modified=False)
|
||||
frappe.publish_realtime(event_name, after_commit=True, user=frappe.session.user)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ frappe.ui.Notifications = class Notifications {
|
|||
me.route_to_settings,
|
||||
__('Notification Settings'),
|
||||
[this.notifications_settings],
|
||||
)
|
||||
);
|
||||
|
||||
this.setup_notifications();
|
||||
this.bind_events();
|
||||
|
|
@ -47,12 +47,12 @@ frappe.ui.Notifications = class Notifications {
|
|||
'frappe.desk.doctype.notification_settings.notification_settings.create_notification_settings';
|
||||
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
if (!settings_doc) return frappe.call(method);
|
||||
})
|
||||
.then(() => {
|
||||
frappe.set_route(`#Form/Notification Settings/${frappe.session.user}`);
|
||||
});
|
||||
.then(() => {
|
||||
if (!settings_doc) return frappe.call(method);
|
||||
})
|
||||
.then(() => {
|
||||
frappe.set_route(`#Form/Notification Settings/${frappe.session.user}`);
|
||||
});
|
||||
}
|
||||
|
||||
setup_notifications() {
|
||||
|
|
@ -389,10 +389,10 @@ frappe.ui.Notifications = class Notifications {
|
|||
: '';
|
||||
let mark_all_read_html =
|
||||
category.value === 'Notifications'
|
||||
? `<span class="mark-all-read pull-right" data-action="mark_all_as_read">
|
||||
${__('Mark all as Read')}
|
||||
</span>`
|
||||
: '';
|
||||
? `<span class="mark-all-read pull-right" data-action="mark_all_as_read">
|
||||
${__('Mark all as Read')}
|
||||
</span>`
|
||||
: '';
|
||||
let html = `<li class="notifications-category">
|
||||
<li class="text-muted header"
|
||||
data-action="${category.action}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue