fix: removed assignment submission email notification
This commit is contained in:
@@ -315,12 +315,6 @@ const tabsStructure = computed(() => {
|
|||||||
doctype: 'Email Template',
|
doctype: 'Email Template',
|
||||||
type: 'Link',
|
type: 'Link',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'Assignment Submission Template',
|
|
||||||
name: 'assignment_submission_template',
|
|
||||||
doctype: 'Email Template',
|
|
||||||
type: 'Link',
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import validate_url, validate_email_address
|
from frappe.utils import validate_url
|
||||||
from frappe.email.doctype.email_template.email_template import get_email_template
|
|
||||||
from frappe.desk.doctype.notification_log.notification_log import make_notification_logs
|
from frappe.desk.doctype.notification_log.notification_log import make_notification_logs
|
||||||
|
|
||||||
|
|
||||||
@@ -15,14 +14,6 @@ class LMSAssignmentSubmission(Document):
|
|||||||
self.validate_url()
|
self.validate_url()
|
||||||
self.validate_status()
|
self.validate_status()
|
||||||
|
|
||||||
def after_insert(self):
|
|
||||||
if not frappe.flags.in_test:
|
|
||||||
outgoing_email_account = frappe.get_cached_value(
|
|
||||||
"Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name"
|
|
||||||
)
|
|
||||||
if outgoing_email_account or frappe.conf.get("mail_login"):
|
|
||||||
self.send_mail()
|
|
||||||
|
|
||||||
def validate_duplicates(self):
|
def validate_duplicates(self):
|
||||||
if frappe.db.exists(
|
if frappe.db.exists(
|
||||||
"LMS Assignment Submission",
|
"LMS Assignment Submission",
|
||||||
@@ -39,38 +30,6 @@ class LMSAssignmentSubmission(Document):
|
|||||||
if self.type == "URL" and not validate_url(self.answer):
|
if self.type == "URL" and not validate_url(self.answer):
|
||||||
frappe.throw(_("Please enter a valid URL."))
|
frappe.throw(_("Please enter a valid URL."))
|
||||||
|
|
||||||
def send_mail(self):
|
|
||||||
subject = _("New Assignment Submission")
|
|
||||||
template = "assignment_submission"
|
|
||||||
custom_template = frappe.db.get_single_value(
|
|
||||||
"LMS Settings", "assignment_submission_template"
|
|
||||||
)
|
|
||||||
|
|
||||||
args = {
|
|
||||||
"member_name": self.member_name,
|
|
||||||
"assignment_name": self.assignment,
|
|
||||||
"assignment_title": self.assignment_title,
|
|
||||||
"submission_name": self.name,
|
|
||||||
}
|
|
||||||
|
|
||||||
moderators = frappe.get_all("Has Role", {"role": "Moderator"}, pluck="parent")
|
|
||||||
for moderator in moderators:
|
|
||||||
if not validate_email_address(moderator):
|
|
||||||
moderators.remove(moderator)
|
|
||||||
|
|
||||||
if custom_template:
|
|
||||||
email_template = get_email_template(custom_template, args)
|
|
||||||
subject = email_template.get("subject")
|
|
||||||
content = email_template.get("message")
|
|
||||||
frappe.sendmail(
|
|
||||||
recipients=moderators,
|
|
||||||
subject=subject,
|
|
||||||
template=template if not custom_template else None,
|
|
||||||
content=content if custom_template else None,
|
|
||||||
args=args,
|
|
||||||
header=[subject, "green"],
|
|
||||||
)
|
|
||||||
|
|
||||||
def validate_status(self):
|
def validate_status(self):
|
||||||
if not self.is_new():
|
if not self.is_new():
|
||||||
doc_before_save = self.get_doc_before_save()
|
doc_before_save = self.get_doc_before_save()
|
||||||
|
|||||||
@@ -58,7 +58,6 @@
|
|||||||
"certification_template",
|
"certification_template",
|
||||||
"batch_confirmation_template",
|
"batch_confirmation_template",
|
||||||
"column_break_uwsp",
|
"column_break_uwsp",
|
||||||
"assignment_submission_template",
|
|
||||||
"payment_reminder_template",
|
"payment_reminder_template",
|
||||||
"seo_tab",
|
"seo_tab",
|
||||||
"meta_description"
|
"meta_description"
|
||||||
@@ -238,12 +237,6 @@
|
|||||||
"fieldtype": "Tab Break",
|
"fieldtype": "Tab Break",
|
||||||
"label": "Email Templates"
|
"label": "Email Templates"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "assignment_submission_template",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"label": "Assignment Submission Template",
|
|
||||||
"options": "Email Template"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_uwsp",
|
"fieldname": "column_break_uwsp",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
@@ -383,7 +376,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-04-10 16:17:00.658698",
|
"modified": "2025-04-17 21:58:30.365876",
|
||||||
"modified_by": "sayali@frappe.io",
|
"modified_by": "sayali@frappe.io",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Settings",
|
"name": "LMS Settings",
|
||||||
|
|||||||
Reference in New Issue
Block a user