fix: remove example users email ids from notifications

currently the system tries sending emails to all users that have
'thread_notify' enabled, including the default example emails that the
Administrator and Guest accounts have. this patch disables email
notifications for these accounts, and additionally tries to disable it
for any other user accounts with example emails

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay D. Pai 2020-07-17 11:32:02 +05:30
parent 34b529f581
commit f12ed9791a
No known key found for this signature in database
GPG key ID: 75507BE256F40CED
3 changed files with 14 additions and 3 deletions

View file

@ -273,6 +273,7 @@ execute:frappe.delete_doc_if_exists('DocType', 'GSuite Templates')
execute:frappe.delete_doc_if_exists('DocType', 'GCalendar Account')
execute:frappe.delete_doc_if_exists('DocType', 'GCalendar Settings')
frappe.patches.v12_0.remove_parent_and_parenttype_from_print_formats
frappe.patches.v12_0.remove_example_email_thread_notify
execute:from frappe.desk.page.setup_wizard.install_fixtures import update_genders;update_genders()
frappe.patches.v12_0.set_correct_url_in_files
frappe.patches.v13_0.website_theme_custom_scss
@ -293,4 +294,4 @@ execute:frappe.delete_doc("DocType", "Onboarding Slide Help Link")
frappe.patches.v13_0.update_date_filters_in_user_settings
frappe.patches.v13_0.update_duration_options
frappe.patches.v13_0.replace_old_data_import # 2020-06-24
frappe.patches.v13_0.create_custom_dashboards_cards_and_charts
frappe.patches.v13_0.create_custom_dashboards_cards_and_charts

View file

@ -0,0 +1,8 @@
import frappe
def execute():
# remove all example.com email user accounts from notifications
frappe.db.sql("""UPDATE `tabUser`
SET thread_notify=0, send_me_a_copy=0
WHERE email like '%@example.com'""")

View file

@ -50,11 +50,13 @@ def install_basic_docs():
install_docs = [
{'doctype':'User', 'name':'Administrator', 'first_name':'Administrator',
'email':'admin@example.com', 'enabled':1, "is_admin": 1,
'roles': [{'role': 'Administrator'}]
'roles': [{'role': 'Administrator'}],
'thread_notify': 0, 'send_me_a_copy': 0
},
{'doctype':'User', 'name':'Guest', 'first_name':'Guest',
'email':'guest@example.com', 'enabled':1, "is_guest": 1,
'roles': [{'role': 'Guest'}]
'roles': [{'role': 'Guest'}],
'thread_notify': 0, 'send_me_a_copy': 0
},
{'doctype': "Role", "role_name": "Report Manager"},
{'doctype': "Role", "role_name": "Translator"},