Commit Graph

4628 Commits

Author SHA1 Message Date
Jesper Hodge
cd2ce32d73 CMS API serializers and validations (#33316)
Internal ticket: https://2u-internal.atlassian.net/browse/TNL-11077

This adds validations to all new CMS API endpoints via serializers.

Validations follow the "strong parameter" concept:
https://www.mintbit.com/blog/securing-ruby-on-rails-applications-part-3-use-strong-parameters#:~:text=Strong%20parameters%20are%20a%20feature,parameters%20to%20a%20controller%20action.
2023-09-22 17:49:49 -04:00
Awais Qureshi
4943674fc1 feat!: upgrading django-storages to 1.13.2 (#33301)
* feat!: upgrading `django-storages` to `1.13.2`
2023-09-21 16:56:50 +05:00
Jesper Hodge
f197f9e61e add swagger for CMS API via drf-spectacular (#33282)
This adds two new urls: `<studio-base>/cms-api/ui` and `<studio-base>/cms-api/schema` with swagger ui and swaggerfile only for the new CMS API using drf-spectacular
2023-09-19 21:06:40 +00:00
Yusuf Musleh
3eb4e0ce9c feat: Update new files notification banner styles (#33197)
Uses the updated styles for the notification based on the new designs.
Includes a button to open view the files directly in the notification.

This also fix a bug where the notification was not appearing when paste
a whole Unit.
2023-09-15 08:58:50 -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
f9c1af775c feat: change problem default display name (#33240) 2023-09-13 11:08:48 -04:00
ruzniaievdm
3978375abf feat: create course home api DRF (#33173) (#33204) 2023-09-08 08:39:31 -04:00
connorhaugh
901ac926bd Revert "feat: create course home api DRF (#33173)" (#33194)
This reverts commit e480a79d9c. as it failed final checks before prod: 
https://github.com/openedx/edx-platform/actions/runs/6098198385/job/16548257136
2023-09-07 13:22:53 +00:00
ruzniaievdm
e480a79d9c feat: create course home api DRF (#33173) 2023-09-06 10:05:25 -04: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
Awais Qureshi
9db024c435 feat!: upgrading django-storages to 1.11.1 2023-08-31 14:21:24 +05:00
Kristin Aoki
878e72024b feat: add API endpoint for asset usage search (#33092) 2023-08-30 11:48:19 -04:00
Awais Qureshi
3c76d6644f Revert "Revert "Revert "feat!: upgrading django-storages to 1.10.1 (#32571)" (#33109)" (#33111)" (#33113)
This reverts commit 2f8475c307.
2023-08-30 19:40:32 +05:00
Awais Qureshi
2f8475c307 Revert "Revert "feat!: upgrading django-storages to 1.10.1 (#32571)" (#33109)" (#33111)
This reverts commit 191b825a2c.
2023-08-28 14:46:21 +05:00
Awais Qureshi
191b825a2c Revert "feat!: upgrading django-storages to 1.10.1 (#32571)" (#33109)
This reverts commit 9281ea4a9a.
2023-08-28 14:05:38 +05:00
Awais Qureshi
9281ea4a9a feat!: upgrading django-storages to 1.10.1 (#32571)
* feat!: upgrading django-storages to 1.10.1
2023-08-28 13:13:28 +05:00
Irtaza Akram
0c46334636 fix: ugetext and ngettext deprecation warnings (#33097) 2023-08-25 14:58:53 +05:00
bszabo
fc4b9e3254 Bszabo/tnl 10766 gaps (#33001)
* feat: TNL-10766 detect block read request

* feat: TNL-10766 add parent and child descriptors

* feat: TNL-10766 simple parent/child return

* feat: TNL-10766 combine results

* feat: TNL-10766 tuples to dictionaries

* feat: TNL-10766 no parent for root block

* feat: TNL-10766 Lint removal

* feat: TNL-10766 test for children w hasattr

* feat: TNL-10766 hasattr + value test

* feat: TNL-10766 fix lint


Missing blank lines & the like

* feat: TNL-10766 more lint fixes

* feat: TNL-10766 undo body to data conversion

* feat: TNL-10766 preserve historical data/fields usage

---------

Co-authored-by: Bernard Szabo <bszabo@edx.org>
2023-08-24 17:44:35 -04: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
ruzniaievdm
b84d45410c feat: add api for help tokens (#33073) 2023-08-23 09:48:16 -04:00
Awais Qureshi
a4b11c02e0 chore: adding test to verify default-acl behaviour. (#33074)
* chore: adding test to verify default-acl behaviour.
2023-08-22 17:01:28 +00: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
Kristin Aoki
98cb27da36 feat: add file size length to returned json (#33068) 2023-08-21 16:26:14 -04:00
German
3f20c75043 feat: [ACADEMIC-16209] Unit summary settings (#32855)
* feat: [ACADEMIC-16209] Unit summary settings

[https://jira.2u.com/browse/ACADEMIC-16209](https://jira.2u.com/browse/ACADEMIC-16209)

1. Add unit xpert unit summaries settings behind flag `summaryhook_summaries_configuration` added [here](https://github.com/edx/ai-aside/pull/45/files)
2. Only show the checkbox when the value is a `boolean` otherwise the feature is considerer `disabled` by the flag.
3. Update block handler to update this value via `api` exposed [here](https://github.com/edx/ai-aside/pull/43)
4. Create `AiAsideSummary` configuration class to provide access to the `ai_aside.api` endpoints.
2023-08-21 14:55:22 -03:00
Braden MacDonald
d60cdc2305 fix: refactor MakoService to allow specifying namespace per template (#33061) 2023-08-21 10:05:38 -07:00
Usama Sadiq
3949c73b35 fix: fix request.is_ajax() deprecation warning (#33055)
* fix: fix request.is_ajax() deprecation warning
2023-08-21 15:59:00 +05:00
Awais Qureshi
a61e7dc524 chore: Adding test to verify s3boto3 storages with invalid params. (#33058)
* chore: Adding test to verify s3boto3 storages with invalid params.
2023-08-21 11:26:28 +05:00
Yusuf Musleh
39e042cfbd feat: Remove component-level copy/paste feature flag (#32980)
This is so that the feature is on by default.
2023-08-18 09:54:48 -07:00
ruzniaievdm
ddb092c07c feat: Create DRF for course team (#32782) 2023-08-17 09:12:02 -04:00
Usama Sadiq
59782fa625 fix: fix is_safe_url and urlquote warnings (#33041)
* fix: fix is_safe_url and urlquote warnings
* fix: replace urlquote with quote
2023-08-17 16:59:23 +05:00
Usama Sadiq
4ee5964855 fix: fix django4 deprecation warnings (#32957) 2023-08-16 14:39:49 +05:00
Braden MacDonald
08fda1b3eb feat: new actions menu for copy/pasting units in Studio (behind waffle flag) (#32891) 2023-08-14 11:58:24 -07: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
Kristin Aoki
69cab96714 feat: remove 403 for disabled advanced settings (#32906) 2023-08-03 19:52:34 +00:00
ruzniaievdm
0d93075a01 fix: api for schedule and details page MFE page (#32890) 2023-08-03 11:41:52 -04:00
Braden MacDonald
1aed4e66af [FC-0009] Studio backend APIs to support copying and pasting of entire Units (#32812)
* feat: tests for copying units in content_staging app

* chore: convert old tests to pytest style

* feat: make pasting units work (in Studio backend API)

* refactor: make XmlMixin.parse_xml more like standard XBlock behavior
2023-08-02 12:24:10 -07:00
Jesper Hodge
6598abbb6b Studio content api videos (#32803)
* refactor: extract methods to video_storage_handlers

* refactor: move private functions

* refactor: move functions to videos_storage_handlers

* refactor: asset_storage_handlers

* feat: add video api views

* feat: add video urls

* feat: add mock videos post

* refactor: mock video upload url

* fix: json extraction

* fix: url pattern for video deletion

* fix: video url views

* fix: lint

* fix: lint

* fix: tests

* fix: tests

* fix: tests

* Feat  studio content api transcripts (#32858)

* feat: add transcript endpoints

feat: add transcript upload endpoint, check that transcripts for deletion exist

fix: remove transcript credentials view cause out of scope

* fix: lint

* feat: TNL-10897 fix destroy() args to kwargs bug

---------

Co-authored-by: Bernard Szabo <bszabo@edx.org>

---------

Co-authored-by: Bernard Szabo <bszabo@edx.org>
2023-07-31 13:37:00 -04:00
Raymond Zhou
122ae72403 feat: add game block button waffle flag checks (#32859) 2023-07-27 13:20:26 -04:00
Muhammad Adeel Tajamul
54467b4583 fix: fixed provider not setting in course discussion settings (#32863)
Co-authored-by: adeel.tajamul <adeel.tajamul@arbisoft.com>
2023-07-27 17:05:37 +05:00
Jillian
8098169eca feat: adds Content Tagging (#32661)
* refactor: moves is_content_creator

from cms.djangoapps.contentstore.helpers to common.djangoapps.student.auth

* feat: adds content tagging app

Adds models and APIs to support tagging content objects (e.g. XBlocks,
content libraries) by content authors. Content tags can be thought of as
"name:value" fields, though underneath they are a bit more complicated.

* adds dependency on openedx-learning<=0.1.0
* adds tagging app to LMS and CMS
* adds content tagging models, api, rules, admin, and tests.
* content taxonomies and tags can be maintained per organization by
  content creators for that organization.
2023-07-26 10:32:59 -07:00
Feanil Patel
5d3eca432e Merge pull request from GHSA-3q74-3rfh-g37j
Co-authored-by: Jesper Hodge <jhodge@outlook.de>
2023-07-25 14:06:06 -04:00
Leangseu Kim
626100596d fix: add correct css and call back for mathjax 2023-07-24 13:27:50 -04:00
Kristin Aoki
948f23a011 feat: return denied when waffle flag disabled (#32795) 2023-07-24 12:32:53 -04:00
Jesper Hodge
7fc32f80b8 add assets to studio content api (#32676)
The purpose of this is to expose the assets_handler endpoint as a public endpoint as part of the studio content API MVP. This allows a course author to register an oauth application in django admin and then retrieve, create and delete assets with this endpoint. You can only update the "locked" attribute for an asset.
2023-07-20 14:18:11 -04:00
connorhaugh
41ec0852e9 feat: command to delete v1 libraries (#32786)
This PR adds a management command to delete v1 content libraries. CLI options are given for a singular library, as well as all libraries. The command raises some errors related to grading, as it uses the code to delete courses, but that is something I can live with for a quick and dirty version of this capability. Also, the pruner will have to be run later to remove any orphan blocks left behind by removing the inde
2023-07-19 15:05:34 -04:00
Agrendalath
92b684004e refactor: reuse services and wrappers between XBlocks (fixed)
This re-applies commit 36cc415 with handling an invalid context_key in the
`PartitionService`. It can happen when rendering a `LibraryContentBlock` in
Studio because this service is initialized by the modulestore when validating
an XBlock to gather its error messages in the `studio_xblock_wrapper`.
2023-07-19 18:01:59 +02:00
Agrendalath
6825088801 Revert "Revert "feat: remove field-data binding from the runtime [FC-0026]" (#32740)"
This reverts commit fa06be106e.
2023-07-19 15:36:26 +02:00
Kyle McCormick
4aedeb8988 refactor: remove XModule JS from Django Pipeline (#32530)
`module-js` and `module-descriptor-js` are old JavaScript group
indicators, left over from when we managed XModule assets via Django
Pipeline. We would like to get rid of them in order to make it easier to
build XModule JS without using Python.

There is one single usage of `module-js` in the entire platform (the
rest have been replaced with Webpack references, which is the
less-outdated way of managing XModule assets :). The lone `module-js`
reference was added in 2013 [1] so that circuit diagrams would display
in the course wiki. However, the ability to render circuits in the wiki
was removed in 2015 [2], so it is safe to remove the reference.

There is also one single usage of `module-descriptor-js`. It's in the
legacy bulk email editor, which hackily cribs from the old HtmlBlock
editor. Fortunately, we are able to simply replace the Django Pipeline
reference with the equivalent XModule JS Webpack bundle. (Note: The old
email editor is currently still supported, but is currently being
replaced by frontend-app-communications, so this hack will be gone
eventually).

Finally, this commit also sneaks in one styling fix: it adds the
HtmlBlockEditor CSS back to the aforementioned legacy bulk email page.
The missing CSS was causing a read-only 1-line codemirror editor to
appear below the HTML editor [3]. This bug was introduced during the
original XModule SCSS decoupling [4], which removed builtin block CSS
from the LMS-wide bundle, thus removing the HTML editor CSS from the
bulk email page. We imagine that nobody noticed because the bug only
exists in master (not Palm) and frontend-app-communications seems to be
globally enabled on edx.org. As a simple fix, we add the new CSS link to
the legacy bulk email page, and it renders fine again [5].

References:

1. 3fc59b3da5
2. https://github.com/openedx/edx-platform/pull/10324
3. Before fix: https://github.com/openedx/edx-platform/assets/3628148/25fc41b2-403d-4339-8c49-0b04664dfa02
4. https://github.com/openedx/edx-platform/pull/32018
5. After fix: https://github.com/openedx/edx-platform/assets/3628148/9a5d74f1-cc83-4ebe-8f0c-ee270f7721b8

Part of: https://github.com/openedx/edx-platform/issues/32481
2023-07-18 09:32:12 -04:00
Braden MacDonald
9b9b88df52 chore: remove some usages of six (Python2 compat) (#32554)
* get rid of six.text_type(s)
* get rid of six.b()
* get rid of six.string_types
* get rid of six.PY2/six.PY3
* get rid of six.iteritems() and six.viewvalues()
2023-07-17 12:18:43 -07:00