fix: email notifications sent only if notifications enabled and remove unused imports
This commit is contained in:
parent
a431b07af3
commit
4833c04609
6 changed files with 6 additions and 10 deletions
|
|
@ -9,7 +9,7 @@ import json
|
|||
from frappe.model.document import Document
|
||||
from frappe.core.doctype.user.user import extract_mentions
|
||||
from frappe.core.doctype.notification_log.notification_log import create_notification_log
|
||||
from frappe.utils import get_fullname, get_link_to_form
|
||||
from frappe.utils import get_fullname
|
||||
from frappe.website.render import clear_cache
|
||||
from frappe.database.schema import add_column
|
||||
from frappe.exceptions import ImplicitCommitError
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ def create_notification_log(names, doc, email_content = None):
|
|||
_doc.reference_user = doc.reference_user
|
||||
_doc.subject = doc.subject.replace('<div>', '').replace('</div>', '')
|
||||
_doc.insert(ignore_permissions=True)
|
||||
if is_email_notifications_enabled(user):
|
||||
send_notification_email(_doc, user, email_content)
|
||||
if is_email_notifications_enabled(user):
|
||||
send_notification_email(_doc, user, email_content)
|
||||
|
||||
def send_notification_email(doc, user, description=None):
|
||||
from frappe.utils import get_fullname, get_url_to_form, strip_html, get_url
|
||||
from frappe.utils import get_url_to_form, strip_html, get_url
|
||||
|
||||
doc_link = get_url_to_form(doc.reference_doctype, doc.reference_name)
|
||||
header = get_email_header(doc)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ from frappe import _
|
|||
from frappe.desk.form.document_follow import follow_document
|
||||
from frappe.core.doctype.notification_log.notification_log import create_notification_log
|
||||
import frappe.utils
|
||||
from frappe.utils import cint
|
||||
import frappe.share
|
||||
|
||||
class DuplicateToDoError(frappe.ValidationError): pass
|
||||
|
|
@ -160,8 +159,6 @@ def notify_assignment(assigned_by, owner, doc_type, doc_name, action='CLOSE',
|
|||
return
|
||||
|
||||
# Search for email address in description -- i.e. assignee
|
||||
from frappe.utils import get_link_to_form
|
||||
|
||||
user_name = frappe.get_cached_value('User', frappe.session.user, 'full_name')
|
||||
title_field = frappe.get_meta(doc_type).get_title_field()
|
||||
title = doc_name if title_field == "name" else \
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from frappe.utils import time_diff_in_seconds
|
||||
from frappe.core.doctype.notification_settings.notification_settings import get_subscribed_documents
|
||||
from six import string_types
|
||||
import json
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ frappe.ui.Notifications = class Notifications {
|
|||
this.$dropdown_list.find('.notification-settings').on('click', (e) => {
|
||||
e.preventDefault();
|
||||
frappe.db.exists('Notification Settings', frappe.session.user).then((exists)=> {
|
||||
if(!exists) {
|
||||
if (!exists) {
|
||||
frappe.call(
|
||||
'frappe.core.doctype.notification_settings.notification_settings.create_notification_settings',
|
||||
).then(() => {
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ def notify_assignment(shared_by, doctype, doc_name, everyone, description=None):
|
|||
|
||||
if not (shared_by and doctype and doc_name) or everyone: return
|
||||
|
||||
from frappe.utils import get_link_to_form, get_fullname
|
||||
from frappe.utils import get_fullname
|
||||
|
||||
title_field = frappe.get_meta(doctype).get_title_field()
|
||||
title = doc_name if title_field == "name" else \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue