platform-plugin-notices
This repo is not currently accepting open source contributions
Overview
This plugin for edx-platform manages notices that a user must acknowledge. It only stores the content of the notices and whether a user has acknowledged them. Presentation and other client side decisions will be left to the frontends that utilize these APIs.
This Django app contains notices that a user must acknowledge before continuing to use the site. This app will have two API endpoints to facilitate that: 1. An endpoint to return links to all notices that the user hasn’t acknowledged. 2. An endpoint to acknowledge that a user has seen the notice. This endpoint’s URL will be passed to the client via the first endpoint.
Two ways to show a notice
Notices are created and edited in Django Admin (Notice with one TranslatedNoticeContent per language, an en row is required as the fallback). No deploy is needed to add, change or switch off a notice (untick active).
Full-page notices (default). GET /notices/api/v1/unacknowledged returns links to the rendered notice pages. Frontends such as the Learning MFE redirect the learner to the page, which acknowledges through POST /notices/api/v1/acknowledge. The global flag notices.enable_notices turns this on.
Refund policy modal. GET /notices/api/v1/refund-policy returns {"show", "notice_id", "body", "language"} as JSON so an MFE can show the notice in a modal (see @edx/refund-policy-notice-plugin in frontend-plugins, mounted in the header_notice_slot of frontend-component-header-edx). It is served for the Notice whose name equals the NOTICES_REFUND_POLICY_NOTICE_NAME setting (default Refund Policy Change) and is controlled by the waffle flag commerce.show_refund_policy_change_notice. It ignores launch_date and snoozing, strips HTML from the body, and the modal acknowledges with POST /notices/api/v1/acknowledge (confirmed). That notice is excluded from the unacknowledged list, so it never redirects to a full page.
Refund policy modal notes:
The Notice name must match NOTICES_REFUND_POLICY_NOTICE_NAME exactly and must not be renamed afterwards. The name decides how the notice is shown: if it no longer matches, the notice becomes a full-page notice and appears in unacknowledged (when notices.enable_notices is on), and learners are redirected to a page with no confirm button.
The body is converted from HTML to plain text: paragraphs are separated by one blank line, <br> becomes a line break, links keep only their text (the URL is dropped), and the contents of <style>, <script> or <button> show up as text, so keep the HTML to simple paragraphs.
The notice is web only. Mobile apps calling unacknowledged?mobile=true do not receive it.
edx.bi.user.displayed_notice and edx.bi.user.acknowledged_notice are emitted server side with tracker.emit, so they always reach the tracking log. They reach Segment only if both names are in EVENT_TRACKING_SEGMENTIO_EMIT_WHITELIST in the LMS config. Full-page notices send the acknowledgement event to Segment from the browser, so add both names to the whitelist to keep the two in one place.
Documentation
(TODO: Set up documentation)
Developing in Devstack
Make sure the LMS container is running in Devstack, then
git clone git@github.com:edx/platform-plugin-notices.git <devstack_folder>/src
cd <devstack_folder>/devstack
make dev.shell.lms
pip install -e /edx/src/platform-plugin-notices
cd /edx/app/edxapp/edx-platform
./manage.py lms migrate
Once that is done, LMS will pickup the plugin and saves to existing files should cause a devserver restart with your changes. Occasionally when adding a new file, you may need to restart the LMS container in order for it to pickup the changes.
Enabling the Notices Plugin in the LMS
The Notices plugin functionality is enabled via use of a waffle flag. After installation of the plugin you need to do the following in devstack:
Log into the LMS Django Admin (http://localhost:18000/admin/)
Add a new waffle flag (http://localhost:18000/admin/waffle/flag/add/)
Name the waffle flag notices.enable_notices
Set Everyone to Yes
Save the waffle flag.
License
The code in this repository is licensed under the AGPL 3.0 unless otherwise noted.
Please see LICENSE.txt for details.
How To Contribute
This repo is not currently accepting open source contributions
Reporting Security Issues
Please do not report security issues in public. Please email security@edx.org.
Support
If you’re having trouble, we have discussion forums at https://discuss.openedx.org where you can connect with others in the community.
Our real-time conversations are on Slack. You can request a Slack invitation, then join our community Slack workspace.
For more information about these options, see the Getting Help page.
Change Log
Unreleased
[0.15.0] - 2026-11-18
Added GET /notices/api/v1/refund-policy returning the refund policy change notice as JSON for MFE modals, gated by the commerce.show_refund_policy_change_notice flag and the NOTICES_REFUND_POLICY_NOTICE_NAME setting.
The refund policy notice is excluded from GET /notices/api/v1/unacknowledged so MFEs do not redirect to its full page; it is shown only as a modal.
Emit server-side edx.bi.user.displayed_notice (each time the modal notice is returned) and edx.bi.user.acknowledged_notice (modal notice only; full-page notices still report it from the browser).
[0.14.55] - 2023-09-25
Fixed PyPI Publish workflow
[0.14.53] - 2023-09-22
Added Django 4.2 Support
[0.14.20] - 2022-07-01
Updating Python Requirements
[0.14.15] - 2022-07-01
Updating Python Requirements
[0.14.11] - 2022-06-01
Updating Python Requirements
[0.14.4] - 2022-02-14
Changed Do not redirect notices/render/{id}/ to login page in case of 403 on mobile request
[0.14.3] - 2022-02-07
Update pip-tools
[0.14.2] - 2022-01-28
Update Python dependencies
[0.14.1] - 2022-01-05
Update Python dependencies
[0.14.0] - 2021-11-24
Add logging
[0.13.0] - 2021-11-24
Added history table to AcknowledgedNotice
[0.12.0] - 2021-11-2
Added support for django 3.2 and dropped support for previous versions
[0.11.8] - 2021-11-10
Update Python dependencies
[0.11.7] - 2021-11-10
Add userLanguage flag so JavaScript-rendered text can be displayed in the correct language
[0.11.6] - 2021-11-10
Add mobile flag so mobile can be disabled in production
[0.11.5] - 2021-11-09
Add lang tag to HTML element
[0.11.4] - 2021-11-08
Change name of segment event from “acquisition” to “notice”
[0.11.3] - 2021-11-05
Allow user to leave page even if API call fails (important for mobile)
[0.11.2] - 2021-11-04
Updated Django admin form list display and searchable fields.
[0.11.1] - 2021-10-29
fix analytics key in template
[0.11.0] - 2021-11-1
Add in a setting to limit the number of days you can snooze a notice.
[0.10.3] - 2021-10-29
Fix dismiss button redirecting
[0.10.2] - 2021-10-29
fix analytics key
[0.10.1] - 2021-10-29
Limit notices to users who were created before it was released
[0.10.0] - 2021-10-25
Add segment library for event tracking
[0.9.0] - 2021-10-25
Add in a snooze limit feature that will only allow a notice to be snoozed a number of times
[0.8.2] - 2021-10-21
Update requirements
[0.8.1] - 2021-10-21
Add ability to reshow notice after a snooze period via setting
[0.7.3] - 2021-10-20
Make AcknowledgedNotice user editable in the admin for testing purposes
[0.7.2] - 2021-10-19
Make AcknowledgedNotice user readonly in the admin for performance
[0.7.1] - 2021-10-19
Add Waffle Flag to enable and disable the feature for rollout
[0.6.1] - 2021-10-7
Add Python API for retrieving unack’d and active notice data
Add Plugin Context API for notice data to support redirects on the LMS Course Dashboard
[0.5.1] - 2021-10-7
Disallow dismissal after confirmation of notice
[0.4.1] - 2021-10-7
Allow inactive (non-email-verified) users to call APIs
[0.3.1] - 2021-10-1
Add mobile calls so notice code can deep link
[0.2.2] - 2021-09-24
Add fallback language on render view
Add Bearer auth to APIs for mobile
Add login requirement to render view
Add first edx-platform dependency
[0.2.1] - 2021-09-22
Utility functions for custom notice code to use to call APIs
[0.1.1] - 2021-09-16
Moved to server rendered notice model
Add mandatory types to acknowledgement to track more states
[0.1.0] - 2021-08-19
First release on PyPI.
Metadata
Release files for edx-notices 0.15.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| edx_notices-0.15.0.tar.gz | 39.8 kB | Without provenance | Details for edx_notices-0.15.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| edx_notices-0.15.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for edx_notices-0.15.0-py2.py3-none-any.whl |
Total release size: 80.1 kB
Release files / edx_notices-0.15.0.tar.gz
| Download URL | edx_notices-0.15.0.tar.gz |
|---|---|
| Size | 39.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55812f42c3bfdb9a9f4c5cb26f105890c41a9572796e0ab4bf5b307699a69df8
|
|
BLAKE2b-256 checksum How to use checksums |
6e709ab3a8b8db31ecd768e8d941433a390bae3b1ece042b4067120c9e26e417
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / edx_notices-0.15.0-py2.py3-none-any.whl
| Download URL | edx_notices-0.15.0-py2.py3-none-any.whl |
|---|---|
| Size | 40.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b6ca1c282b427251bf362c103bbe6ad7eb9f8aea452cb45724f4ddf6c6a6f16b
|
|
BLAKE2b-256 checksum How to use checksums |
7d4679ced7217744b874f0e65dde7abf56a225998463461f216af6a6e6a7b3e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for edx-notices 0.15.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.