Merge pull request #15066 from ruchamahabal/disable-event-reminders

feat: Option to disable Event Reminders in Notification Settings
This commit is contained in:
mergify[bot] 2021-11-24 10:31:08 +00:00 committed by GitHub
commit 0538b46eb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 3 deletions

View file

@ -11,6 +11,7 @@ from frappe import _
from frappe.model.document import Document
from frappe.utils.user import get_enabled_system_users
from frappe.desk.reportview import get_filters_cond
from frappe.desk.doctype.notification_settings.notification_settings import is_email_notifications_enabled_for_type
weekdays = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
communication_mapping = {"": "Event", "Event": "Event", "Meeting": "Meeting", "Call": "Phone", "Sent/Received Email": "Email", "Other": "Other"}
@ -141,7 +142,12 @@ def has_permission(doc, user):
def send_event_digest():
today = nowdate()
for user in get_enabled_system_users():
# select only those users that have event reminder email notifications enabled
users = [user for user in get_enabled_system_users() if
is_email_notifications_enabled_for_type(user.name, 'Event Reminders')]
for user in users:
events = get_events(today, today, user.name, for_reminder=True)
if events:
frappe.set_user_lang(user.name, user.language)

View file

@ -14,6 +14,7 @@
"enable_email_assignment",
"enable_email_energy_point",
"enable_email_share",
"enable_email_event_reminders",
"user",
"seen",
"system_notifications_section",
@ -97,12 +98,19 @@
"fieldname": "energy_points_system_notifications",
"fieldtype": "Check",
"label": "Energy Points"
},
{
"default": "1",
"depends_on": "enable_email_notifications",
"fieldname": "enable_email_event_reminders",
"fieldtype": "Check",
"label": "Event Reminders"
}
],
"in_create": 1,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2021-11-16 12:18:46.955501",
"modified": "2021-11-24 14:45:31.931154",
"modified_by": "Administrator",
"module": "Desk",
"name": "Notification Settings",
@ -125,4 +133,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
}

View file

@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe Technologies and Contributors
# See license.txt
# import frappe
import unittest
class TestNotificationSettings(unittest.TestCase):
pass