165 Commits

Author SHA1 Message Date
Muhammad Farhan Khan
ee3551538c test: Move VideoConfigService related tests near inside its app (#38008) 2026-02-24 12:18:27 +05:00
Irtaza Akram
76018183d4 Use runtime-provided XQueueService instead of constructing it in ProblemBlock (#37998)
* fix: move xqueue services
2026-02-19 11:02:00 +05:00
salmannawaz
d20b87b180 Discussion service to enable permission and access provider (#37912)
* chore: discussion service to enable permission and access provider
2026-02-11 19:37:16 +05:00
Navin Karkera
8ca70db552 refactor: xblock api upstream info and course details api (#37971)
- Returns top parent key instead of boolean in upstream info api
- Adds edited_on raw time in course outline api
- Adds has_changes to course details api
2026-02-09 23:09:06 +00:00
Irtaza Akram
8b5a22ea3a fix: deprecate enable_grading_method_in_problems (#37811) 2026-01-29 12:11:51 +05:00
Akanshu Aich
2d82d90279 refactor: migrated FEATURES dict settings to top-level in core files and fixed related test files. (#37389)
* refactor: moved remaining feature dicts settings into top-level settings.

* refactor: moved remaining feature dicts settings into top-level settings.

* fix: fixed the test files

* fix: fixed tehe pylint errors

* fix: fixation of the cms ci failure

* fix: fixed remaining feature settings for cms

* fix: added fix for requirements

* fix: added fix for lms tests

* fix: resolved the test views issue

* fix: configured views file and test_views

* fix: fixed lint errors and assertion issues

* fix: added fix for base url issue in test view

* fix: added fix for base_url and assertion issue

* fix: added configurations for base utl fix

* fix: handled none issue for mfe config

* fix: corrected override settings in test views

* fix: added getattr defensive technique for view settings

* fix: reverted views and test_views file

* fix: added settings in views file

* fix: added with patch within functions in test view

* fix: rearranged the features in default_legacy_config

* fix: fixing the tests  with clearing cache

* fix: reverted test views to verify the CI check

* fix: added cache clear in mfe config test

* fix: fixed the patch toggles to override settings

* fix: fixed the lint errors

* fix: changed patch toggle to override settings
2026-01-20 11:55:26 -05:00
M. Tayyab Tahir Qureshi
a6c3c3236d chore: make the tests run for both BuiltIn and Extracted LTI Blocks (#36020) 2026-01-19 16:07:06 +05:00
Tarun Tak
f841763640 chore: use zoneinfo instead of pytz 2026-01-09 11:43:33 -05:00
Irtaza Akram
d29b0473f4 fix: align pylint fixes in edx-platform Problem XBlock with extracted xblocks-contrib/problem (#37758)
* fix: pylint issues for problem xblock
2026-01-07 16:39:11 +05:00
Irtaza Akram
33cc1a94ba chore: upstream ProblemBlock exceptions and shared utilities to XBlock (#37806)
* fix: add support for xblock 5.3.0
2026-01-07 13:30:53 +05:00
Irtaza Akram
87bf1003b7 fix: remove settings.DEBUG from problem block (#37812)
* fix: remove settings.DEBUG from problem block
2026-01-06 17:51:50 +05:00
David Ormsbee
1d9ca333cf fix: correct upstream field for migrated libraries (#37804)
This is to fix an issue in the following common migration situation:

1. An existing course references content in a legacy content library.
2. The legacy content library is migrated to the new library system.
3. The user clicks on "Update reference" from the Randomized Content
   Block in the course.

This action is supposed to update the children of the
LibraryContentBlock (usually ProblemBlocks) so that the "upstream"
attribute is set to point at the UsageKeys of the content in the new
libraries they were migrated to. What was happening instead was that the
upstream entries for these child blocks were left blank, breaking the
upstream/sync connection and making it so that the courses did not
receive any updates from the migrated libraries.

There were two issues:

1. get_forwarding_for_blocks() was being called with the child UsageKeys
   in the course, when it should have been called with the v1 library
   usage keys instead (since those are the things being forwarded).
2. We were checking that the target_key was a v2 Library key, but really
   the upstream target_key is supposed to be a LibraryUsageLocatorV2,
   i.e. the key of the specific piece of content, not the library it
   ended up in.

Note on testing:

Although there were unit tests for the migration of legacy content
libraries, there were not any unit tests for the migration of legacy
library *blocks*.

This commit adds a minimal test, which would have caught the bug we're
fixing. It would be good to add more comprehensive testing unit testing
for this part of the migration flow.

---------

Co-authored-by: Kyle McCormick <kyle@axim.org>
2026-01-05 16:35:31 -05:00
Muhammad Farhan Khan
360a97fdd3 refactor: Move available_translations into VideoConfigService (#37808)
This moves edx-platform-specific logic out of the VideoBlock,
in preparation for the VideoBlock extraction:
openedx#36282
2025-12-26 18:56:57 +05:00
Kyle McCormick
91e521ef51 fix: Various fixes to modulestore_migrator (#37711)
For legacy library_content references in courses, this PR:
- **Removes the spurious sync after updating a reference to a migrated
  library**, so that users don't need to "update" their content _after_
  updating their reference, _unless_ there were real content edits that
  happened since they last synced. We do this by correctly associating a
  DraftChangeLogRecord with the ModulestoreBlockSource migration artifact,
  and then comparing that version information before offering a sync.
  (related issue:
  https://github.com/openedx/frontend-app-authoring/issues/2626).
- **Prompts users to update a reference to a migrated library with higher
  priority than prompting them to sync legacy content updates for that
  reference**, so that users don't end up needing to accept legacy content
  updates in order to get a to a point where they can update to V2 content.
- **Ensures the library references in courses always follow the correct
  migration,** as defined by the data `forwarded` fields in the data model,
  which are populated based on the REST API spec and the stated product UI
  requirements.

* For the migration itself, this PR:

- **Allows non-admins to migrate libraries**, fixing:
  https://github.com/openedx/edx-platform/issues/37774
- **When triggered via the UI, ensures the migration uses nice title-based
  target slugs instead of ugly source-hash-based slugs.** We've had this as an
  option for a long time, but preserve_url_slugs defaulted to True instead of
  False in the REST API serializer, so we weren't taking advantage of it.
- **Unifies logic between single-source and bulk migration**. These were
  implement as two separate code paths, with drift in their implementations. In
  particular, the collection update-vs-create-new logic was completely
  different for single-souce vs. bulk.
- **When using the Skip or Update strategies for repeats, it consistently
  follows mappings established by the latest successful migration** rather than
  following mappings across arbitrary previous migrations.
- **We log unexpected exceptions more often**, although there is so much more
  room for improvement here.
- **Adds more validation to the REST API** so that client mistakes more often
  become 400s with validation messages rather than 500s.

For developers, this PR:
- Adds unit tests to the REST API 
- Ensures that all migration business logic now goes through a general-purpose
  Python API.
- Ensures that the data model (specifically `forwarded`, and
  `change_log_record`) is now populated and respected.
- Adds more type annotations.
2025-12-18 23:49:36 +00:00
M. Tayyab Tahir Qureshi
24cb3cf9f5 refactor: enable the Extracted Annotatable, Poll XBlocks
Enabled the Extracted Annotatable, Poll XBlocks 

---------

Co-authored-by: farhan <farhan.khan@arbisoft.com>
2025-12-16 18:22:57 +05:00
Irtaza Akram
99c6e901d9 Convert Problem Block Mako Templates to Django Templates (#37570)
* fix: convert mako to django templates for problem block

* fix: pylint issues
2025-12-09 19:29:06 +05:00
Irtaza Akram
1945b12769 Autoformat Problem XBlock Source Files for Consistency (1/2) (#37476)
* fix: run formatter black and isort

* fix: linting, pydocstyle, xsslint and security issues
2025-12-05 18:31:45 +05:00
Muhammad Farhan Khan
a50ab7d75f chore: Move waffle flags, configs (used in video block) to video service
Merge pull request #37631 from openedx/farhan/add-waffle-flags
2025-11-17 17:52:29 +05:00
Muhammad Farhan Khan
f51343c871 refactor: move transcripts_utils from xmodule to video-config (#37600)
As part of the ongoing effort to deprecate and eventually remove xmodule,
we’ve started gradually migrating the necessary code files from xmodule
to more appropriate locations within the codebase.

Ticket: https://github.com/openedx/public-engineering/issues/445

Also: this tweaks importlinter ignores & add follow-up issue links

Co-authored-by: Kyle McCormick <kyle@axim.org>
2025-11-14 18:26:35 +00:00
farhan
0cd62bf786 refactor: Introduce VideoConfig service, move video sharing methods in it 2025-11-11 12:55:02 +05:00
Kyle McCormick
834cb9482d refactor: rename ModuleStore runtimes now that XModules are gone (#35523)
* Consolidates and renames the runtime used as a base for all the others:
  * Before: `xmodule.x_module:DescriptorSystem` and
            `xmodule.mako_block:MakoDescriptorSystem`.
  * After:  `xmodule.x_module:ModuleStoreRuntime`.

* Co-locates and renames the runtimes for importing course OLX:
  * Before: `xmodule.x_module:XMLParsingSystem` and
            `xmodule.modulestore.xml:ImportSystem`.
  * After:  `xmodule.modulestore.xml:XMLParsingModuleStoreRuntime` and
            `xmodule.modulestore.xml:XMLImportingModuleStoreRuntime`.
  * Note: I would have liked to consolidate these, but it would have
          involved nontrivial test refactoring.

* Renames the stub Old Mongo runtime:
  * Before: `xmodule.modulestore.mongo.base:CachingDescriptorSystem`.
  * After: `xmodule.modulestore.mongo.base:OldModuleStoreRuntime`.

* Renames the Split Mongo runtime, the which is what runs courses in LMS and CMS:
  * Before: `xmodule.modulestore.split_mongo.caching_descriptor_system:CachingDescriptorSystem`.
  * After: `xmodule.modulestore.split_mongo.runtime:SplitModuleStoreRuntime`.

* Renames some of the dummy runtimes used only in unit tests.
2025-10-29 15:46:07 -04:00
Muhammad Anas
4afff6ef5c feat: shift progress calculation to backend, add never_but_include_grade (#37399)
This commit migrates the data calculation logic for the GradeSummary
table, which was previously in the frontend-app-learning.

This commit also introduces a new visibility option for assignment
scores: “Never show individual assessment results, but show overall
assessment results after the due date.”

With this option, learners cannot see question-level correctness or
scores at any time. However, once the due date has passed, they can
view their overall score in the total grades section on the Progress
page.

These two changes are coupled with each other because it compromises
the integrity of this data to do the score hiding logic on the front
end.

The corresponding frontend PR is: openedx/frontend-app-learning#1797
2025-10-22 10:15:42 -04:00
Chris Chávez
3f5ac6ddbc fix: Update on_commit_changes_to of modulestore to check MySQL transaction [FC-0097] (#37485)
- `handle_update_xblock_upstream_link` is called asynchronously with celery. In `update_upstream_downstream_link_handler`, the xblock has the updated version, but when calling `handle_update_xblock_upstream_link` inside Celery, the xblock is outdated in a previous version, which is why the error occurs. This happens because `on_commit_changes_to` is executed before the MySQL transaction ends.
- Added `ImmediateOnCommitMixin` to be used in tests that need to call `on_commit_changes_to`. See https://github.com/openedx/edx-platform/pull/37485#issuecomment-3412979170  for more info
2025-10-20 17:02:04 -05:00
Navin Karkera
744cc87ffb feat: follow migrated legacy library content block (#37405)
* feat: show item bank ui for migrated legacy library content

* feat: migrate legacy content block to item bank block on view in studio

* fix: duplicate and copy issues

* refactor: migration location and add tests

* fix: lint issues

* fix: item bank and library content children view add button functionality

Newly added blocks from library in children view page of item bank block
and migrated library content block were not displayed automatically.

* fix: lint issues

* fix: lint issues

* feat: only migrate if same version of library is migrated

* refactor: migrate block on request

* fix: component reload on migration

* fix: tests

* refactor: comments and message wordings

* refactor: update alert text

* docs: add context

* fix: component links not being created on migrating legacy blocks

* fix: api docs and types

* refactor: use inheritance and specific parent method call

* fix: imports

* fix: api typing

* fix: upstream_version check

* refactor: rename variables

* refactor: parsing entity keys to usage_keys
2025-10-20 11:20:37 +05:30
Navin Karkera
09e86e24b2 refactor!: use String field instead of Dict field to store top_level_downstream_parent_key (#37448)
* refactor!: use String field instead of Dict field to store top_level_downstream_parent_key

Since this is a new field no production instance should have this field
yet. Developers need to delete their old courses as this change will
raise error in all course pages.

* chore: add `top_level_parent` field in ComponentLink and ContainerLink admin

* refactor: use ":" as separator

* refactor: block key parsing and tests
2025-10-09 22:03:23 +05:30
Kyle McCormick
0c77083e3a revert: fix: support parsing the pointer-tag OLX for external XBlocks (#37426)
This reverts commit d382721cf8,
which seems to break edx-platform's ability to load the content of externally-
defined xblocks (e.g. lti_consumer) from course exports.
2025-10-03 15:57:26 -04:00
M. Tayyab Tahir Qureshi
d382721cf8 fix: support parsing the pointer-tag OLX for external XBlocks (#37133)
Previously, the built-in XBlocks (problem, video, etc) could be parsed
from pointer tag syntax, but externally-defined XBlocks (drag-and-drop,
ORA, etc.) could only be parsed from inline syntax. This is because the
built-in blocks have special parsing logic, defined in XmlMixin,
which is not available to external blocks.

This PR shifts the pointer tag parsing "up a level" such that the parent
blocks parse the pointer tag, regardless of whether the child is built-in
or external:
* vertical (aka unit)
* split_test (aka content experiment)
* itembank (aka problem bank)
* library_content (aka randomized legacy library)

The following parent blocks still lack support for external pointer-tag children;
we will fix this in a follow-up PR:
* randomize
* all externally defined container blocks

Part of: https://github.com/openedx/XBlock/issues/823
2025-10-03 11:54:30 -04:00
Kyrylo Kireiev
777ba88218 feat: [AXM-2398] Add short label to assignment (#36970)
Rationale: The instructor may create short labels that are longer than
3 characters, and they can be hard to work with in the mobile UI. Thus,
on mobile, it was decided to add short labels to the api response by
getting them from section breakdown, which ensures they are consistent
with the labels the user sees in the Grading section.
2025-09-18 10:46:02 -04:00
Irtaza Akram
35adeafafd fix: Allow tests for Extracted & Builtin Annotatable XBlock (#36246)
Test Annotatable XBlock in both built-in and extracted modes to keep them in sync.

Related to: https://github.com/openedx/edx-platform/issues/34841
2025-08-15 11:44:04 -04:00
Irtaza Akram
bbfdce0f9a fix: Allow tests for Extracted & Builtin HTML XBlock (#36399)
Test HTML XBlock in both built-in and extracted modes to keep them in sync.

Related to: https://github.com/openedx/edx-platform/issues/36283
2025-08-15 11:42:30 -04:00
salmannawaz
983cdf9274 Test PR | Enable Extracted Poll XBlock (#36566)
* chore: poll xblock extracted code enable PR
2025-08-12 16:17:10 +05:00
Muhammad Farhan Khan
4a9fc77ecb test: Allow for Extracted Word Cloud Block | Fix Test Cases (#35983)
Run tests for both the built-in and extracted WordCloud block.
The tests are mostly compatible with both versions of the block,
except for a few places where the XBlock framework and the
built-in XModule system differ which we've had to handle using
conditionals.

This moves us closer to enabling the extracted WordCloud block
by default and eventually removing the built-in block.

Part of: https://github.com/openedx/edx-platform/issues/34840
2025-08-08 11:22:26 -04:00
Ram Chandra Bhavirisetty
c9912b2661 feat: remove mongodb_proxy in favor of MongoDB's built-in retryReads (#37011)
This PR removes the usage of the custom `mongodb_proxy` package from
edx-platform, replacing it with MongoDB's built-in retry functionality via
`retryReads=True`.

Changes:

* Removed all references to `mongodb_proxy.MongoProxy` from connection logic.
* Updated `connect_to_mongodb()` to always use `retryReads=True`.
* Uninstalled `openedx-mongodbproxy` from edx-platform requirements.

Fixes: https://github.com/openedx/edx-platform/issues/35210
2025-07-21 13:52:55 -04:00
Tim McCormack
447fd0b6cb feat: Upgrade to codejail 4.0.0 (#36916)
This brings an important security improvement -- codejail won't default to
running in unsafe mode, which can happen if certain configuration errors
are present.

Properly configured installations shouldn't be affected. We just need to
adjust some unit tests to opt into unsafe mode.

Changes:

- Update `edx-codejail` dependency to [version 4.0.0](https://github.com/openedx/codejail/blob/master/CHANGELOG.rst#400---2025-06-13)
- Define a `use_unsafe_codejail` decorator that allows running a unit test (or entire TestCase class) in unsafe mode
- Use that decorator as needed, based on which tests started failing
2025-06-17 09:33:52 -04:00
KEVYN SUAREZ
db8766d4aa fix: Include metadata for blocked sequence units to enable proper navigation (#36485)
The original issue was that when a sequence was locked due to prerequisites, the API returned an empty items array ([]). This prevented the frontend from knowing what units were inside the locked sequence, meaning it couldn't construct the URLs correctly for navigation so the next/previous buttons stop working.
2025-06-10 20:06:46 +02:00
Daniel Wong
a51f87be43 test: removing unused tests related to masking 2025-05-14 09:42:43 -06:00
Asad Ali
797438e91b fix: save video asides during XML course import 2025-04-22 23:59:55 +05:00
gabrielC1409
db27ab6166 feat: Send xqueue submissions to edx-submission
fix: Restructuring to send course_id and score to edx submission

fix: Refactoring of sending information to sent_to_submission

fix: Elimination of unnecessary functions

fix: Added usage comment to ProblemBlock in XqueueInterface constructor

fix: update doc ADR

fix: setting for Quality Others test (ubuntu-24.04, 3.11, 20)

fix: Deprecation for django-trans-escape-filter-parse-error

test: Add @pytest.mark.django_db decorator to test functions

test: Fix for pylint being disabled

fix: updated changes for pylint disable

fix: update error from docs ADR-0005

update: xmodule/docs/decisions/0005-send-data-to-edx-submission.rst

Co-authored-by: Sarina Canelake <sarina@axim.org>

update: xmodule/docs/decisions/0005-send-data-to-edx-submission.rst

Co-authored-by: Sarina Canelake <sarina@axim.org>

fix: Adjusted correction

fix: update date for docs ADR

Revert "fix: update date for docs ADR"

This reverts commit 0b4229c51c4937f95cb407872645dd448df45418.

fix: replace call created_submission to create_external_grader_detail

fix: update test xqueue_submission

fix: add docstring in test_xqueue_submission

fix: update date doc ADR

fix: update version edx-submission 3.8.6

fix: add @pytest.mark.xfail

fix: add 20 chances in test_capa_block:

fix: increase retry attempts for seed generation in ProblemBlockTest

fix: change version to edx-submission lib

fix: new version edx-submission in testings

fix: replace parameter file to files

fix: update variable grader_file_name and points_possible

fix: Adjustment in the is_flag_active function to always take the last record edited in the waffle

fix: wrap large line of code

fix: update function is_flag_active

fix: code style adjustment

fix: changes for 60 retry

feat: use CourseWaffleFlag to determine xqueue callback path

fix: Code style adjustment

fix: remove deprecated xqueue callback route and simplify callback type logic

fix: Deleting a comment in the ADR document

fix: add log in self.block is None

fix: Code style adjustment in log
2025-04-15 11:59:32 -04:00
Irtaza Akram
de75c37047 fix: duplicate rendering of instructions in annotatable xblock (#36445)
In the Annotatable XBlock, the <instructions> element was appearing
twice in the student view:

* Once in "annotatable-instructions" (where it should be).
* Again in "annotatable-content" (where annotations and other content are rendered).

The _render_content method processed and rendered the entire XML
data, including <instructions>, without removing it. The
_extract_instructions method, which is responsible for removing
<instructions>, was not called in _render_content, leading to
duplication.

This fix will:

* Prevents duplicate instructions in the student view.
* Maintains the expected behavior of showing instructions only in
  "annotatable-instructions".
* No impact on existing annotation functionality.
2025-04-10 11:01:38 -04:00
Navin Karkera
2613c8ef4e feat: preserve image alt text while converting html to text (#36333)
Replace image with its alt text while converting html to plain text for indexing.
2025-03-06 16:55:45 +00:00
Chris Chávez
b6489e718c feat: Video editor supports transcripts [FC-0076] (#36058)
* Add error handler on save video to avoid creating sjson
* Support transcripts without edx_video_id in definition_to_xml
* When copying a video from a library to a course: Create a new edx_video_id
* Save transcripts as static assets in a video in a library when adding a new transcript.
* Delete transcripts as static assets in a video in a library when deleting transcripts.
* Support download transcript in a video in a library.
* Support replace transcript in a video in a library.
* Support updating transcripts in video in a library.
* Refactor the code of downloading YouTube transcripts to enable this feature in libraries.
* Support copy from a library to a course and a course to a library.
2025-02-21 13:33:13 -05:00
Chris Chávez
d29ff63e2c fix: Render Word cloud block editor in libraries [FC-0076] (#36199)
* fix: Render Word cloud and conditional block editor

- The xmodule-type to render is MetadataOnlyEditingDescriptor
- The xmodule type `MetadataOnlyEditingDescriptor` renders a `<div>` with the block metadata in the `data-metadata` attribute. But is necessary to call `XBlockEditorView.xblockReady()` to run the scripts to build the editor using the metadata.
- To call XBlockEditorView.xblockReady() we need a specific require.config

* fix: Adding save and cancel button

* fix: save with studio_submit of conditional_block and word_cloud_block

* test: Tests for studio_submit of conditional and word cloud

* revert: Delete studio_submit of conditional block. It is not supported

* style: Fix lint

---------

Co-authored-by: Navin Karkera <navin@opencraft.com>
2025-02-19 18:05:55 +05:30
David Ormsbee
9a6cdbf8e2 perf: upgrade XBlock to 5.1.1 for caching unknown tags
This should improve performance for courseware operations when there is
content that doesn't map to any existing XBlocks in the system. This
usually happens to old courses when custom XBlock types are deprecated
and removed, or when a course is imported from another instance with a
different set of installed XBlocks.
2025-01-22 14:36:50 -05:00
Kyle D. McCormick
88b8da3e49 docs: Remove the last couple mentions of Paver from the codebase
Part of: https://github.com/openedx/edx-platform/issues/34467
2025-01-02 14:05:15 -05:00
Adolfo R. Brandes
394a459dec feat: remove the broken Zooming Image Tool
The Zooming Image Tool does not load properly, currently, and even if it
did, relying on an external Javascript to function across releases is
not something we can support.  Thus, we remove it from the list of HTML
block templates until such time as a more robust solution is found.
2024-12-09 13:05:40 -03:00
farhan
9b4e805a0a feat!: Drop sass support from porblem/cappa xblocks 2024-11-08 17:22:48 +05:00
Muhammad Farhan Khan
6259520651 Merge branch 'master' into farhan/sass-to-css-video-block 2024-10-23 18:52:43 +05:00
farhan
8fb5b778c3 feat!: Dropping Sass support from builtin video block, replacing with vanilla CSS 2024-10-23 18:40:30 +05:00
Braden MacDonald
9e28ba92ec feat: minimal UI for the Problem Bank block 2024-10-22 17:27:04 -07:00
Kyle McCormick
08c8e9d214 feat: ItemBankBlock (#35553)
This is a new XBlock that presents a random subset of its children. As of this commit, the block
can only be added as an Advanced component. For Sumac, we plan to enable it as part of the
Libraries Relaunch Beta, under the name "Problem Bank (Beta)"

The block does not care if its children are from V1 library, V2 library, or the course itself.
It shares the randomization logic with LegacyLibraryContentBlock. It is also fully backwards-compatible with LegacyLibraryContentBlock. So, once V1 libraries are migrated to V2 libraries (after Teak), we eventually
could point the `library_content` entry point at ItemBankBlock.

Part of: https://github.com/openedx/frontend-app-authoring/issues/1385
2024-10-22 15:40:46 -04:00