* refactor: simplified tasks.py for discussions
* fix: do not create a topic for the unpublished unit
* feat: added user messages and backed now uses discussion_enabled flag
* fix: update default for discussion_enabled flag
* feat: removed redundant tests and fixes
When running in a sharded MongoDB setup it's possible that querying the
modulestore right after the course publish signal will not return the
latest data.
This commit adds a delay similar to the one used in other places in the
codebase for a similar reason.
Course topics are now created by traversing the entire course structure from top to bottom instead of starting at the sequential level and then moving up or down as needed.
This also introduces a lot of debug logs to pontetially find the reason why under some circumstances new units don't get processed and end up without a discussions topic.
This commit attempts to fix cases where dicussion topic links aren't created
during a provider change.
It does so by eliminating areas where there could be desynchronisation between
the configuration the course configuration in Mogo and the discussion config
in MySQL.
The topic creation code now uses the database version of the config which is
more recent.
The new mechanism for marking that a unit has discussions is to use the
discussion_enabled flag instead of adding a discussion block. This change
adds code that is run during the course rerun process to mark any existing
units that have a discussion block as discussible using the new mechanism.
It doesn't touch the existing discussion blocks.
If the new discussions configuration experience is globally enabled, this
will also switch from the legacy provider to the new provider. It analyses
the course for any discussion blocks that have been added to graded
subsections, and if that is the case, it also automatically enables
discussions in graded subsections (which are otherwise disabled for new
courses by default).
Tracks a discussion topics' section and subsection in a new context field so that we have access to that information when the topic's section/subsection/unit has been deleted. This is then used when a topic is deleted to append the section and subsection name to the topic title.
ADR: https://github.com/openedx/edx-platform/pull/29928
This PR changes the default behaviour of the discussions experience by making the previous "unit-level
visibility" the default mechanism for configuring discussions.
Prior to this PR, under the new discussions configuration experience, all units would automatically get
assigned a discussion topic and have discussions enabled for them (other than units in graded or exam
subsections). However, if authors wanted they could enabled a custom visibility mode which would allow
toggling discussions on or off on a per-unit level.
This PR makes this custom visibility mode the standard behaviour (and eventually, only behaviour)
and enables discussion for all units by default. This replicates the behaviour that already existed,
however, now gives authors control over disabling discussions for individual units by default.
It also removes the ability to disable discussions for all units (while still keeping course-wide
discussions) enabled.
* refactor: modified the imports to use openedx-events library
* chore: upgrade openedx-events to latest version
* fix: ran isort to avoid style errors
Co-authored-by: Maria Grimaldi <maria.grimaldi@edunext.co>
* feat: New API for discussion topics
Creates a new API for discussion topics that uses auto-crated discussion topic links for the new discussion provider.
* squash!: refresh migration
* feat: Adds a new discussion topic configuration mechanism
The new discussion configuration system links discussion topics directly to the course structure. This change adds a new task that sends a discussion update signal if there are any changes to the course. This signal includes all the context needed to update the configuration of the course.
The handler for this new event will create a new entry for each unit that needs a topic in the database. In the future this will be used to see the topics in the course.
* fix: add support for marking a provider as supporting LTI
* fix: review feedback