From 7ac436c28e0d3f160c2cf09f341edfbc9f159427 Mon Sep 17 00:00:00 2001
From: Sven Marnach <sven@marnach.net>
Date: Fri, 23 Jun 2017 13:45:46 +0200
Subject: [PATCH] Add flag to configure whether "Notify users by email" is
 checked by default.

---
 lms/envs/common.py                                            | 4 ++++
 .../instructor/instructor_dashboard_2/membership.html         | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lms/envs/common.py b/lms/envs/common.py
index 4074841c7e3..c10a8e56ed1 100644
--- a/lms/envs/common.py
+++ b/lms/envs/common.py
@@ -388,6 +388,10 @@ FEATURES = {
 
     # Allow users to change their email address.
     'ALLOW_EMAIL_ADDRESS_CHANGE': True,
+
+    # Whether to check the "Notify users by email" checkbox in the batch enrollment form
+    # in the instructor dashboard.
+    'BATCH_ENROLLMENT_NOTIFY_USERS_DEFAULT': True,
 }
 
 # Settings for the course reviews tool template and identification key, set either to None to disable course reviews
diff --git a/lms/templates/instructor/instructor_dashboard_2/membership.html b/lms/templates/instructor/instructor_dashboard_2/membership.html
index bdf89ea17e9..4b5c4120232 100644
--- a/lms/templates/instructor/instructor_dashboard_2/membership.html
+++ b/lms/templates/instructor/instructor_dashboard_2/membership.html
@@ -64,7 +64,8 @@ from django.utils.translation import ugettext as _
     </div>
     <div class="enroll-option">
         <label class="has-hint">
-            <input type="checkbox" name="email-students" id="email-students" value="Notify-students-by-email" checked="yes" aria-describedby="heading-batch-enrollment">
+          <input type="checkbox" name="email-students" id="email-students" value="Notify-students-by-email" aria-describedby="heading-batch-enrollment"
+                 ${'checked="yes"' if settings.FEATURES.get('BATCH_ENROLLMENT_NOTIFY_USERS_DEFAULT') else ''}>
             <span class="label-text">${_("Notify users by email")}</span>
             <div class="hint email-students-hint">
                 <span class="hint-caret"></span>
-- 
GitLab