Commit Graph

300 Commits

Author SHA1 Message Date
Kyle D. McCormick
e8b60aef60 fix: move BlockKey and derived_key to avoid cyclical import
After we merged this PR: https://github.com/openedx/edx-platform/pull/33920
this error began popping up in logs:

    Unable to load XBlock 'staffgradedxblock'
    ....
    ImportError: cannot import name 'get_course_blocks' from
    partially initialized module 'lms.djangoapps.course_blocks.api'
    (most likely due to a circular import) ...

The root cause was the new imports of `derived_key` and `BlockKey` into
xmodule/library_content_block.py. Those new imports come from
xmodule/modulestore/store_utilities.py, which runs
`XBlock.load_classes()` at the module level, which fails because we are
still in the process of loading xmodule/library_content_block.

As a solution, we move both `derived_key` and `BlockKey` to
xmodule/util/keys.py. We could potentially move that file to opaque-keys
eventually, depending on how well we think that those concepts generalize.

Also:

* We rename the function from derived_key to derive_key, as
  functions should be verbs.
* We combine the first to parameters of derive_key (a source ContextKey
  and a source BlockKey) into a single parameter (a source UsageKey). In
  my opinion, this makes the function call easier to understand.
2024-01-16 09:37:40 -05:00
Omar Al-Ithawi
a5251cc705 feat: atlas pull for XBlock translations 2024-01-12 12:49:46 +03:00
connorhaugh
2b47b8a379 feat: make course -> lib import synchronous (#34030)
* feat: make course -> lib import synchronous

---------

Co-authored-by: Kyle McCormick <kyle@axim.org>
2024-01-09 15:54:02 -05:00
connorhaugh
efaef4510e fix: protect video transcript handler from scraper (#34017)
Web scrapers do annoying stuff like visit urls they shouldn't know about and cause xblock handlers to break.
I tested this by:
Making sure video transcripts worked as normal while logged in
making sure that I got no 500s in my logs while attempting to view it logged out.
2024-01-08 18:14:03 -05:00
Feanil Patel
5ec8737856 chore: Remove old datadog related settings.
Datadog was removed 6+ years ago but some settings and related keys got
left behind.  Get rid of them since we don't need them and also to
prevent people from assuming it's okay to hardcode datadog settings into
our codebase.
2023-12-14 12:17:37 -05:00
Kyle McCormick
140f85853d feat!: remove Content Libraries V2 index (#33888)
BREAKING CHANGE: Removes all code, tests, and settings related to
indexing of V2 (blockstore-backed) content libraries in elasticsearch.
This includes indexing of top-level library metadata as well as indexing
of library block metadata. Operators who enabled the experimental
Library Authoring MFE *and* the experimental ENABLE_CONTENT_LIBRARY_INDEX
feature may notice that sorting, filtering, and searching of V2
libraries and their blocks may now be slower and/or less powerful.
The ENABLE_CONTENT_LIBRARY_INDEX feature was already disabled by
default, so most/all operators (including edx.org) should not notice
any difference.

Removed settings include:

* FEATURES['ENABLE_CONTENT_LIBRARY_INDEX']
* ENABLE_ELASTICSEARCH_FOR_TESTS
* TEST_ELASTICSEARCH_USE_SSL
* TEST_ELASTICSEARCH_HOST
* TEST_ELASTICSEARCH_PORT

For rationale, see the updated "Status" section of:
./openedx/core/djangoapps/content_libraries/docs/decisions/0001-index-libraries-in-elasticsearch.rst
2023-12-07 14:57:31 -05:00
Brandon Bodine
ce2621642f fix: lint 2023-11-29 11:34:55 -07:00
Rodrigo Martin
d7482735c3 fix: hide feedback widget by default 2023-11-29 11:34:55 -07:00
Rodrigo Martin
8d02b8808f feat: rename 'video_uuid' to 'video_id' in AI translation request (#33787) 2023-11-28 20:56:42 -03:00
Awais Qureshi
9998dc58fe Upgrade pillow (#33769)
* build: upgrading pillow.
2023-11-27 13:45:59 +05:00
David Ormsbee
119bb46151 docs: create ADR for Wasm-based safe code execution (#33705) 2023-11-22 09:28:43 -05:00
Kyle McCormick
e800ae7622 feat: provisionally support V2 libraries in LibraryContentBlock (randomized only) (#33263)
Refactors and reworks the LibraryContentBlock so that its
sync-from-library operations are asynchronous and work with
V2 content libraries. This also required us to make
library_content block duplication asynchronous, as that
involves syncing from the source library.

For the sake of clarity, this PR includes two major method renames:

* update_children(...) -> sync_from_library(...)
* refresh_library(...) -> sync_from_library(upgrade_to_latest=True, ...)

an an XBlock HTTP handler rename:

  /refresh_children -> /upgrade_and_sync

There are still a couple issues with import or duplication
of library_content blocks referencing V2 libraries other than
latest. These will be resolved in an upcoming PR.

Part of: https://openedx.atlassian.net/wiki/spaces/COMM/pages/3820617729/Spec+Memo+Content+Library+Authoring+Experience+V2
Follow-up work: https://github.com/openedx/edx-platform/issues/33640

Co-authored-by: Connor Haugh <chaugh@2u.com>
Co-authored-by: Eugene Dyudyunov <evgen.dyudyunov@raccoongang.com>
2023-11-20 15:58:10 +00:00
Rodrigo Martin
e51c01bf4e feat: add support for user feedback on autogenerated transcripts (#33518)
* feat: WIP transcript feedback

* feat: Add UI mock for Transcript Feedbacks (#33416)

* feat: Add UI mock for Transcript Feedbacks

* fix: Fix mongo tests

* feat: Get video_uuid, user_uuid and language for request (#33445)

* feat: make call to ai-translations to obtain feedback

* feat: Show widget if transcript was AI generated

* feat: bind all class methods

* fix: async calls

* feat: send request when choosing feedback

* feat: update showing condition (#33474)

* fix: ajax success lint

* fix: video caption specs errors fixed

* feat: add coverage to feedback widget

* chore: connect XT to LMS and CMS

* feat: use url

* chore: add vars to devstack

* chore: fix url name

* feat: update unit tests regarding env vars

* fix: fix test_video_mongo

* feat: add more tests

* feat: remove console log

Co-authored-by: Jesper Hodge <19345795+jesperhodge@users.noreply.github.com>

* fix: rename shouldShowWidget to loadAndSetVisibility

---------

Co-authored-by: María Guillermina Véscovo <mvescovo@2u.com>
Co-authored-by: Jesper Hodge <19345795+jesperhodge@users.noreply.github.com>
2023-11-06 16:33:53 +00:00
Piotr Surowiec
2cf4d73a98 Merge pull request #33601 from DanielVZ96/dvz/clean-warnings
chore: clean and fix console warnings
2023-11-06 16:50:37 +01:00
Feanil Patel
66e987997c Revert "Revert "chore: remove bok-choy settings"" 2023-11-01 13:41:37 -04:00
Daniel Valenzuela
115c65aa18 fix: flags not at the start of the expression
related issue: https://github.com/openedx/edx-platform/issues/33585
2023-11-01 00:18:40 -03:00
Daniel Valenzuela
72be4812bf chore: replace newrelic add_custom_parameter deprecated method
related issue: https://github.com/openedx/edx-platform/issues/33584

note: it has been replaced with add_custom_attribute. it is just a rename
https://docs.newrelic.com/docs/release-notes/agent-release-notes/python-release-notes/python-agent-80300/
2023-11-01 00:18:40 -03:00
Robert Raposa
083ccbf09b Revert "chore: remove bok-choy settings" 2023-10-31 15:27:44 -04:00
salman2013
9452cef97d chore: resolve conflicts 2023-10-23 12:05:25 +05:00
Feanil Patel
2e75ced467 Merge pull request #33186 from thezaeemaanwar/remove_badges_app
[DEPR]: lms/djangoapps/badges
2023-10-20 10:29:43 -04:00
Kyle McCormick
9c6e765bf6 test: run ./xmodule/ tests with CMS settings (#33534)
Currently, ./xmodule/ unit tests are only run with LMS settings. However,
./common/ and ./xmodule/ are run twice: once with LMS settings and once with
CMS settings.

Just like ./common/ and ./openedx/, the unit tests in ./xmodule/ validate
behavior in both LMS and CMS. So, order to fully test ./xmodule/, we should to
run its tests with CMS settings too.

This will enable us to better validate certain LibraryContentBlocks behaviors
being touched by https://github.com/openedx/edx-platform/pull/33263 which can't
be expressed under LMS settings.

Also in this commit:

* refactor: rename the shards to be clear whether they're running under LMS or CMS
* docs: correct comments regarding conditions under which codejail's
   test_cant_do_something_forbidden is skipped.
* test: update a unit test which was using the now-deleted library_sourced block to use
   library_content block instead.
2023-10-19 10:19:28 -04:00
thezaeemaanwar
0b3e4d73b6 feat!: Removed Badges App
fix: restored badges handlers

feat: remove FE code for badges

fix: resolved failing tests

fix: removed test case for badges app

fix: unused import error

fix: Response Field Count

fix: shareable account response length

fix: resolved PR comments

fix: revert settings override

feat!: Removed Badges App

fix: restored badges handlers

feat: remove FE code for badges

fix: resolved failing tests

fix: removed test case for badges app

fix: unused import error

fix: Response Field Count

fix: shareable account response length

fix: revert subscription badge
2023-10-18 20:30:04 +05:00
Feanil Patel
7202c22e1d Merge pull request #33373 from openedx/feanil/update_password_length_default
feat: Update the minimum password length.
2023-10-17 10:08:15 -04:00
Feanil Patel
64e91d4080 test: Update to an even longer password. 2023-10-12 10:31:13 -04:00
farhan
ff17e51699 refactor: remove xblockutils package 2023-10-11 14:46:09 +05:00
Feanil Patel
1e2ea85372 test: Update more tests that had short passwords. 2023-10-10 16:36:26 -04:00
David Ormsbee
6710af6d13 feat!: remove Matlab key from Studio Problem settings
The Matlab-specific code is coupled with XQueue in places, making its
removal a little tricky. But we at least want to hide this now-useless
field from end-users before we cut the Quince release.

https://github.com/openedx/public-engineering/issues/192
2023-10-05 11:12:35 -04:00
salman2013
52860c5c9d chore: resolve conflicts 2023-10-04 18:45:02 +05:00
IrfanUddinAhmad
e003217d51 fix: Added xblock skill tag verification waffle switch 2023-10-04 14:28:39 +05:00
salman2013
42ca0ddec4 chore: remove bok choy settings 2023-09-27 10:58:37 +05:00
Kyle McCormick
07979774a6 docs: ADR: Evolving the library_content block schema (#33231)
Co-authored-by: connorhaugh <49422820+connorhaugh@users.noreply.github.com>
2023-09-18 13:47:08 +00:00
Yusuf Musleh
12ea8e91b4 fix: Pasting unit with LibraryContentBlock error (#33160) 2023-09-15 08:59:11 -07:00
Kyle McCormick
265701c01d feat!: remove library_sourced block (#33257)
Originally, we planned to add support for V2 libraries and for static
(hand-selected) library block reference via new block type: library_sourced.

We have since decided that it would be better to add those capabilities
in-place to the existing library_content block. This will ease V1->V2
library migration and make adoption of the new features easier for current
library users. It will also avoid duplication of logic between two block types,
we we fear would be error-prone. For details, see this ADR:
 https://github.com/openedx/edx-platform/pull/33231

So, we are removing the library_sourced block.
This block has existed in edx-platform for a few years now, but was not
enabled by default and never officially supported. It was only usable via the
experimental V2 content library feature. Operators who added library_sourced
blocks to their course will now see them render as `HiddenBlock` instances, i.e.:

> ERROR: "library_sourced" is an unknown component type...

This should not impact other component types in such courses and should not
impact import/export.
2023-09-15 10:04:38 -04:00
Kristin Aoki
e820162572 fix: add public video share valid course key check (#33260) 2023-09-15 09:05:59 -04:00
salmannawaz
648a30249a Deprecation of edx-user-state-client repo (#33218)
* chore: add code for edx-user-state-client in edx-platform
2023-09-14 18:53:37 +05:00
Kristin Aoki
f9c1af775c feat: change problem default display name (#33240) 2023-09-13 11:08:48 -04:00
Babatunde Olusola
6e2c43e4e0 refactor: update codejail test condition (#32955)
Skip the test for codejail if the codejailservice api is not enabled.
It fixes running this test case in Tutor.
2023-09-07 17:08:30 +02:00
Sagirov Evgeniy
c5d1807c81 feat!: remove most Old Mongo functionality (#31134)
This commit leaves behind just enough Old Mongo (DraftModulestore)
functionality to allow read-only access to static assets and the
root CourseBlock. It removes:

* create/update operations
* child/parent traversal
* inheritance related code

It also removes or converts tests for this functionality.

The ability to read from the root CourseBlock was maintained for
backwards compatibility, since top-level course settings are often
stored here, and this is used by various parts of the codebase,
like displaying dashboards and re-building CourseOverview models.

Any attempt to read the contents of a course by getting the
CourseBlock's children will return an empty list (i.e. it will look
empty).

This commit does _not_ delete content on MongoDB or run any sort of
data migration or cleanup.
2023-09-06 10:01:31 -04:00
Rômulo Penido
6e28ba329e feat: add language auto-tagging with feature flag (#32907) 2023-09-01 11:09:46 -07:00
Kyle McCormick
6704901a77 fix: include the correct SCSS file for lti_block (#33155)
There exists a Sass file for lti_block's display, but not for its editor.

However, during the `add_sass_to_fragment` refactoring, I mixed that up:
I added a non-existent scss file to the studio_view but didn't add
the actual scss file to the student_view.

Course authors using the (deprecated) lti_block saw:

    We're having trouble rendering your component
    Students will not be able to access this component. Re-edit your component to fix the error.

    Error: Sass not found: /edx/app/edxapp/edx-platform/xmodule/assets/LTIBlockEditor.scss

as a result of this bug.

Original PR: https://github.com/openedx/edx-platform/pull/32592
Private-ref: https://2u-internal.atlassian.net/browse/TNL-11029
2023-09-01 13:28:20 -04:00
Braden MacDonald
a013c08ae6 fix: incorrect type hints in a few places (#33104) 2023-08-28 10:34:08 -07:00
Braden MacDonald
f491f5bde8 fix: refactor MakoService to allow specifying template more explicitly (Take 2) (#33077)
* fix: refactor MakoService to allow specifying namespace per template (#33061)

* fix: instr. dashboard broken by bulk email reusing HtmlBlock studio_view

* fix: lint issue from unused import
2023-08-23 11:48:06 -07:00
Eugene Dyudyunov
4340a832f7 Add the default enrollment start date on course creation (#30954)
* fix: main page course listing

The course is visible on the main page right after creation when the feature toggle `CREATE_COURSE_WITH_DEFAULT_ENROLLMENT_START_DATE` is on.

So anonymous users can see them and access the course about page
for the courses without valid data (e.g. they will see the default
course overview)

When courses list filtering is processed it checks the `see_exists`
permission for the anonymous user.
Actually, `see_exists` means `can_load` OR `can_enroll`.

`can_load` is False in our case because the course start in the future.

But `can_enroll` returns True because the course's enrollment_start
and enrollment_end dates are blank:
```
enrollment_start = courselike.enrollment_start or datetime.min.replace(tzinfo=UTC)
enrollment_end = courselike.enrollment_end or datetime.max.replace(tzinfo=UTC)
if enrollment_start < now < enrollment_end:
    debug("Allow: in enrollment period")
    return ACCESS_GRANTED
```

Set the enrollment_start the same as a course start by default
2023-08-22 10:42:19 -04:00
Usama Sadiq
7710e60328 fix: fix middleware get_response parameter deprecation warning (#33067) 2023-08-22 15:52:30 +05:00
bszabo
68e9a03708 Revert "fix: refactor MakoService to allow specifying namespace per template (#33061)" (#33070)
This reverts commit d60cdc2305.
2023-08-21 16:32:58 -04:00
Braden MacDonald
d60cdc2305 fix: refactor MakoService to allow specifying namespace per template (#33061) 2023-08-21 10:05:38 -07:00
Usama Sadiq
2dba053022 fix: fix django.utils.translations warnings (#33040)
* fix: fix ugetext and ngettext deprecation warnings
* fix: fix deprecation warnings from html templates
2023-08-18 11:34:56 +05:00
Usama Sadiq
852246db8c fix: replace ugettext with gettext (#33022) 2023-08-16 17:07:23 +05:00
connorhaugh
4b38b1f750 feat: mgmt cmd to replace v1 libr refs in courses (#32904)
This PR adds a management command to, given a mapping of V1 content libraries to matching v2 content libraries, replaces references to v1 libs in courses (in library source xblocks) with V2 libraries. It does so by manipulating the mongo document directly.

it also offers some improvements to the management command which copies all v1 libraries into v2 libraries.
2023-08-11 09:48:34 -04:00
Syed Ali Abbas Zaidi
8480dbc228 chore: apply amnesty on existing not fixable issues (#32215)
* fix: eslint operator-linebreak issue

* fix: eslint quotes issue

* fix: react jsx indent and props issues

* fix: eslint trailing spaces issues

* fix: eslint line around directives issue

* fix: eslint semi rule

* fix: eslint newline per chain rule

* fix: eslint space infix ops rule

* fix: eslint space-in-parens issue

* fix: eslint space before function paren issue

* fix: eslint space before blocks issue

* fix: eslint arrow body style issue

* fix: eslint dot-location issue

* fix: eslint quotes issue

* fix: eslint quote props issue

* fix: eslint operator assignment issue

* fix: eslint new line after import issue

* fix: indent issues

* fix: operator assignment issue

* fix: all autofixable eslint issues

* fix: all react related fixable issues

* fix: autofixable eslint issues

* chore: remove all template literals

* fix: remaining autofixable issues

* chore: apply amnesty on all existing issues

* fix: failing xss-lint issues

* refactor: apply amnesty on remaining issues

* refactor: apply amnesty on new issues

* fix: remove file level suppressions

* refactor: apply amnesty on new issues
2023-08-07 19:13:19 +05:00