diff --git a/.gitignore b/.gitignore index b7faf40..5548863 100644 --- a/.gitignore +++ b/.gitignore @@ -173,7 +173,7 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ # Abstra # Abstra is an AI-powered process automation framework. @@ -182,9 +182,9 @@ cython_debug/ .abstra/ # Visual Studio Code -# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore +# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore -# and can be added to the global gitignore or merged into this file. However, if you prefer, +# and can be added to the global gitignore or merged into this file. However, if you prefer, # you could uncomment the following to ignore the entire vscode folder # .vscode/ diff --git a/README.rst b/README.rst index 1b05dfa..59906b2 100644 --- a/README.rst +++ b/README.rst @@ -17,7 +17,25 @@ Usage .. code-block:: bash tutor plugins enable notifications +Configuration +************* +The plugin exposes the following Tutor configuration keys : + - ``NOTIFICATIONS_DEFAULT_FROM_EMAIL`` + - Default: inherits from the platform `CONTACT_EMAIL`. + - Purpose: sets the default "from" address used when sending notification emails. + +.. code-block:: yaml + + NOTIFICATIONS_DEFAULT_FROM_EMAIL: "no-reply@example.org" + +After changing configuration,restart environment so the new environment variable and settings are picked up by the LMS and MFE images. +If you rely on a specific "from" email for outgoing notifications, explicitly set ``NOTIFICATIONS_DEFAULT_FROM_EMAIL`` rather than relying on the platform-wide ``CONTACT_EMAIL``. + + +The email and push notification settings under Account can be enabled/disabled using `NOTIFICATIONS_ENABLE_SHOW_EMAIL_CHANNEL` +and `NOTIFICATIONS_ENABLE_SHOW_PUSH_CHANNEL`. `NOTIFICATIONS_ENABLE_SHOW_EMAIL_CHANNEL` is set to True while `NOTIFICATIONS_ENABLE_SHOW_PUSH_CHANNEL` +is set to False by default. License ******* diff --git a/tutornotifications/patches/lms-env b/tutornotifications/patches/lms-env new file mode 100644 index 0000000..4c430a1 --- /dev/null +++ b/tutornotifications/patches/lms-env @@ -0,0 +1 @@ +NOTIFICATIONS_DEFAULT_FROM_EMAIL: '{{ NOTIFICATIONS_DEFAULT_FROM_EMAIL }}' diff --git a/tutornotifications/patches/mfe-lms-production-settings b/tutornotifications/patches/mfe-lms-production-settings index 01d2894..7bc43a3 100644 --- a/tutornotifications/patches/mfe-lms-production-settings +++ b/tutornotifications/patches/mfe-lms-production-settings @@ -1,2 +1,3 @@ -MFE_CONFIG["SHOW_EMAIL_CHANNEL"] = True +MFE_CONFIG["SHOW_EMAIL_CHANNEL"] = {{ NOTIFICATIONS_ENABLE_SHOW_EMAIL_CHANNEL }} +MFE_CONFIG["SHOW_PUSH_CHANNEL"] = {{ NOTIFICATIONS_ENABLE_SHOW_PUSH_CHANNEL }} diff --git a/tutornotifications/patches/openedx-common-settings b/tutornotifications/patches/openedx-common-settings new file mode 100644 index 0000000..fda8c7a --- /dev/null +++ b/tutornotifications/patches/openedx-common-settings @@ -0,0 +1 @@ +NOTIFICATIONS_DEFAULT_FROM_EMAIL = ENV_TOKENS.get("NOTIFICATIONS_DEFAULT_FROM_EMAIL", ENV_TOKENS["CONTACT_EMAIL"]) diff --git a/tutornotifications/plugin.py b/tutornotifications/plugin.py index ed2bbde..49fe7bb 100644 --- a/tutornotifications/plugin.py +++ b/tutornotifications/plugin.py @@ -17,6 +17,9 @@ # Each new setting is a pair: (setting_name, default_value). # Prefix your setting names with 'NOTIFICATIONS_'. ("NOTIFICATIONS_VERSION", __version__), + ("NOTIFICATIONS_ENABLE_SHOW_EMAIL_CHANNEL", True), + ("NOTIFICATIONS_ENABLE_SHOW_PUSH_CHANNEL", False), + ("NOTIFICATIONS_DEFAULT_FROM_EMAIL", "{{ CONTACT_EMAIL }}") ] ) @@ -133,6 +136,5 @@ "org.openedx.frontend.layout.studio_header_search_button_slot.v1", notification_drawer_config, ), - ], )