This PR fixes the user not being created when accessing the discussion xblock as the course_key was missing in some of the api calls and that lead to the forum backend not being fetched correctly.
This change modifies the SessionInactivityTimeout middleware to prevent
the session ID from changing on every request while still enforcing the
inactivity timeout.
Key improvements:
- Store datetime values as ISO strings for proper serialization
- Implement hybrid session save approach that only allows full session
saves periodically (controlled by SESSION_SAVE_FREQUENCY_SECONDS)
- Preserve session ID between requests while still tracking user activity
This resolves the issue where lms_sessionid was changing on every user
interaction, which caused problems.
BREAKING CHANGE: The breaking change is that SESSION_ACTIVITY_SAVE_DELAY_SECONDS was introduced with a 15 minute default, which will change the current behavior. It is not necessarily breaking (since it actually fixes an issue), but this is to bring more attention to the new setting because the default is reasonable, but also somewhat arbitrary.
Index the newly created course after import and course re-run. Also recreate upstream links after course re-run.
We make use of newly created COURSE_RERUN_COMPLETED signal to run post re-run processes.
* test: Test for publish section/subsection
* test: published_by is now None for unpublished containers
* test: adds TODO comments to the tests
in anticipation of publishing container children
* feat: adds api to retrieve library block/container hierarchy
* test: adds query counts for hierarchy API tests
These are really high, but highlight the need for future optimizations.
* perf: reduce hierarchy API query counts
* perf: cut query counts in half
Required a refactor of the approach to avoid using the Metadata classes.
* chore: trigger ci
* chore: update openedx-learning constraint
* chore: compile requirements
* test: updating query count
* style: Add missing comment in kernel.in
* fix: get_container_from_key param and comments
* docs: mark api as UNSTABLE and add comment about get_library_object_hierarchy implementation
---------
Co-authored-by: Jillian Vogel <jill@opencraft.com>
Co-authored-by: Rômulo Penido <romulo.penido@gmail.com>
- Adds the `top_level_parent_usage_key` to the `EntityLinkBase`
- This field is used to save the top-level parent of a component or container when it is imported into a course. Example: A unit with components imported into a course. The unit is the top-level parent of the components.
- Updates the `DownstreamListView` to return the top-level parents instead of downstream child, if this parent exists.
- Each time containers with children were synchronized, a new downstream block was created for each child instead of updating the existing one. This occurred because the `upstream_key` was incorrectly validated as an `Opaquekey` against a list of key strings. This was fixed by converting the `upstream_key` to a string before the verification. (see 34cd5a4781 and 29647831dc)
- Which edX user roles will this change impact? "Course Author", "Developer".
* feat: copy endpoint for Library Containers
* fix: make source_usage_key optional and removing upstram info for xblock olx
* test: add tests
* refactor: remove unecessary changes to reduce diff
* fix: change assert
* feat: add `write_upstream` field to ContainerSerializer
* fix: remove comment
* refactor: change `source_usage_key` type and more
* fix: try to infer the source version
* fix: InvalidKeyError while copying container with assets
* fix: read source_version from OLX
* fix: remove store check
* fix: change ident
Co-authored-by: Braden MacDonald <mail@bradenm.com>
* feat: fill source_version and make get_component_version_from_block public
* refactor: rename `source_key` to `copied_from_block`
* test: add test to `write_copied_from=false`
* fix: removing unused fallback elif
* fix: remove `copied_from_block` param
---------
Co-authored-by: Braden MacDonald <mail@bradenm.com>
DRF was swallowing an underlying error string and providing its own
which was being checked for here.
See https://github.com/encode/django-rest-framework/pull/8051 for
details.
The new version fixes that underlying issue and so the test failed.
Rather than checking for the exact string of the 404 which is not
relevant, we now just verify that the error code associated with the
request matches the HTTP response. This should make the test more
resilient to future text changes in the underlying Django function
`get_object_or_404`
When linking a DRF serializer with a model, you need to link it to the
model class not an instance of the model.
The newer version of DRF tries to access the model_manager from the
model here and runs into issues if it's not defined correctly.
Previously we were doing the following query:
SELECT 1 AS "a" FROM "user_api_userpreference" WHERE ("user_api_userpreference"."key" = 'pref-lang' AND "user_api_userpreference"."user_id" = 1 AND NOT ("user_api_userpreference"."id" = 1)) LIMIT 1
Looking at the middleware, I don't see why this was previously
happening.
In the effort to simplify settings in edx-platform, as discussed in ADR 22 -
Settings Simplification, this PR brings some of the production defaults defined
in `lms/envs/production.py` and `cms/envs/production.py` up to
`openedx/envs/common.py` or `lms/envs/common.py` and `cms/envs/common.py` as
appropriate.
Bringing these defaults up from the `production.py` settings modules caused
changes in the rendered settings of the `test.py` modules, and so I have
settings to the `test.py` modules to bring the rendered settings back in line
with what is has been. I have not deeply looked at which settings are needed
for tests to pass or not, but just the differences between the rendered
settings between `master` and this branch.
ADR 22: https://github.com/openedx/edx-platform/blob/master/docs/decisions/0022-settings-simplification.rst
Fixes https://github.com/openedx/edx-platform/issues/36892.
The dump_settings management command is
used for debugging changes to Django settings.
When comparing settings between two branches or
modules side-by-side, it is very useful to have the keys
print out in a deterministic order.
Affects developers only. This has no end-user impact.
In the serializer, return an empty string if there is no request object.
In content_tagging, just update the type declaration to match the
expectation since it can obviously be a None type.
Fix lack of the permissions for course staff/instructor roles.
Allows course staff/admin users use cohorts API, e.g. for
cohort filters in the Gradebook MFE.
In the context of edx-platform django settings,
devstack_docker is an alias to devstack. Both
are deprecated, technically, but we currently
want to remove all devstack-related settings files
except devstack.py (which tutor still uses). So,
in order to remove devstack_docker.py, we update
its references to devstack.py