Commit Graph

6303 Commits

Author SHA1 Message Date
Kyle McCormick
127c5c1ce2 fix: make built-in XBlock Sass theme-aware again
In ~Palm and earlier, all built-in XBlock Sass was included into LMS and CMS
styles before being compiled. The generated CSS was coupled together with
broader LMS/CMS CSS. This means that comprehensive themes have been able to
modify built-in XBlock appearance by setting certain Sass variables. We say that
built-in XBlock Sass was, and is expected to be, "theme-aware".

Shortly after Palm, we decoupled XBlock Sass from LMS and CMS Sass [1]. Each
built-in block's Sass is now compiled into two separate CSS targets, one for
block editing and one for block display. The CSS, now located at
`common/static/css/xmodule`, is injected into the running Webpack context with
the new `XModuleWebpackLoader`. Built-in XBlocks already used
`add_webpack_to_fragment` in order to add JS Webpack bundles to their view
fragments, so when CSS was added to Webpack, it Just Worked.

This unlocked a slieu of simplifications for static asset processing [2];
however, it accidentally made XBlock Sass theme-*unaware*, or perhaps
theme-confused, since the CSS was targeted at `common/static/css/xmodule`
regardless of the theme. The result of this is that **built-in XBlock views will
use CSS based on the Sass variables _last theme to be compiled._** Sass
variables are only used in a handful of places in XBlocks, so the bug is subtle,
but it is there for those running off of master. For example, using edX.org's
theme on master, we can see that there is a default blue underline in the Studio
sequence nav [3]. With this bugfix, it becomes the standard edX.org
greenish-black [4].

This commit makes several changes, firstly to fix the bug, and secondly to leave
ourselves with a more comprehensible asset setup in the `xmodule/` directory.

* We remove the `XModuleWebpackLoader`, thus taking built-in XBlock Sass back
  out of Webpack.

* We compile XBlock Sass not to `common/static/css/xmodule`, but to:

  * `[lms|cms]/static/css` for the default theme, and
  * `<THEME_ROOT>/[lms|cms]/static/css`, for any custom theme.

  This is where the comprehensive theming system expects to find themable
  assets. Unfortunately, this does mean that the Sass is compiled twice, both
  for LMS and CMS. We would have liked to compile it once to somewhere in the
  `common/`, but comprehensive theming does not consider `common/` assets to be
  themable.

* We split `add_webpack_to_fragment` into two more specialized functions:
  * `add_webpack_js_to_fragment` , for adding *just* JS from a Webpack bundle,
    and
  * `add_sass_to_fragment`, for adding static links to CSS compiled themable
    Sass (not Webpack). Both these functions are moved to a new module
    `xmodule/util/builtin_assets.py`, since the original module
    (`xmodule/util/xmodule_django.py`) didn't make a ton of sense.

* In an orthogonal bugfix, we merge Sass `CourseInfoBlock`, `StaticTabBlock`,
  `AboutBlock` into the `HtmlBlock` Sass files. The first three were never used,
  as their styling was handled by `HtmlBlock` (their shared parent class).

* As a refactoring, we change Webpack bundle names and Sass module names to be
  less misleading:
  * student_view, public_view, and author_view: was `<Name>BlockPreview`, is now
    `<Name>BlockDisplay`.
  * studio_view: was `<Name>BlockStudio`, is now `<Name>BlockEditor`.

* As a refactoring, we move the contents of `xmodule/static` into the existing
  `xmodule/assets` directory, and adopt its simper structure. We now have:
  *  `xmodule/assets/*.scss`: Top-level compiled Sass modules. These could be
     collapsed away in a future refactoring.
  * `xmodule/assets/<blocktype>/*`: Resources for each block, including both JS
    modules and Sass includes (underscore-prefixed so that they aren't
    compiled). This structure maps closely with what externally-defined XBlocks
    do.
  * `xmodule/js` still exists, but it will soon be folded into the
    `xmodule/assets`.

* We add a new README [4] to explain the new structure, and also update a
  docstring in `openedx/lib/xblock/utils` which had fallen out of date with
  reality.

* Side note: We avoid the term "XModule" in all of this, because that's
  (thankfully) become a much less useful/accurate way to describe these blocks.
  Instead, we say "built-in XBlocks".

Refs:
1. https://github.com/openedx/edx-platform/pull/32018
2. https://github.com/openedx/edx-platform/issues/32292
3. https://github.com/openedx/edx-platform/assets/3628148/8b44545d-0f71-4357-9385-69d6e1cca86f
4. https://github.com/openedx/edx-platform/assets/3628148/d0b7b309-b8a4-4697-920a-8a520e903e06
5. https://github.com/openedx/edx-platform/tree/master/xmodule/assets#readme

Part of: https://github.com/openedx/edx-platform/issues/32292
2023-07-06 11:58:06 -04:00
alangsto
6f00f63da6 feat: add course waffle flag for learner assistant (#32657) 2023-07-06 10:19:58 -04:00
Ahtisham Shahid
b477a20ad2 Added notifications for discussions events (#32432)
* feat: added notifications for discussions app

* feat: added unit tests for handler

* feat: updated openedx-events package

* fix: updated notification creation logic and tests

* refactor: updated openedx-event version and event name

* refactor: moved logic to separate methods
2023-07-06 13:33:20 +05:00
Awais Ansari
67b97705c8 refactor: update non-editable into snake case non_editable (#32654) 2023-07-06 12:17:29 +05:00
Edward Zarecor
9e5f7bb782 Merge branch 'master' into edx-depr31 2023-07-05 09:53:55 +02:00
Muhammad Adeel Tajamul
ac5b0870db feat: added support for translation in notifications (#32626) 2023-07-04 15:13:14 +05:00
Muhammad Adeel Tajamul
a71c34a969 feat: added management command to delete expired notifications (#32556) 2023-07-04 11:59:54 +05:00
Edward Zarecor
aff9d82b7d Merge branch 'master' into edx-depr31 2023-07-04 08:39:10 +02:00
Feanil Patel
567704cc3a Merge pull request #32608 from openedx/feanil/small_fix
fix: Don't assume there is a context.
2023-07-03 11:29:16 -04:00
Awais Ansari
e543a68990 feat: add pagination in course enrollment list API (#32546)
* feat: add pagination in course enrollment list API

* refactor: enrollment course list API

* refactor: follow best practice in course enrollment list API
2023-07-03 13:52:15 +05:00
John Nagro
6d5dcdf77a fix: improve username generation (#32613) 2023-06-30 09:47:02 -04:00
Agrendalath
36cc415fc2 refactor: reuse services and wrappers between XBlocks 2023-06-30 15:06:43 +02:00
Piotr Surowiec
80374ed1ce Merge pull request #32357 from open-craft/agrendalath/fc-0026-field-data
feat: remove field-data binding from the runtime [FC-0026]
2023-06-30 15:06:17 +02:00
Feanil Patel
cf9c4e83bf fix: Don't assume there is a context.
Don't assume that there will be an extra `context` kwarg when using the
bookmark serializer.  We use it this way in the current code but that's
specific to us and not comon to all serializers.  There are a lot of API
documentation tools that automate introspecting serializers but they
won't know  that they have to send in a `context` to the serializer.

To make this serializer behave more like other serializers without
changing the behavior, we just need to check that the `context` value is
defined before we dig into it.  In the case that there is no `context`
we just treat it the same as if there is no `request` in the `context`.
2023-06-29 13:01:18 -04:00
Jansen Kantor
17c4fc03d4 feat: add course field for ORA flex peer override (#32594)
* feat: add course field for ORA flex peer override

* style: quality

* style: remove auto import
2023-06-29 12:48:33 -04:00
Yagnesh1998
751411951d feat: Remove block_structure.invalidate_cache_on_publish waffle flag … (#32517)
* feat: Remove block_structure.invalidate_cache_on_publish waffle flag depr33.

* feat: Update test_signals.py

* feat: Update signals.py

---------

Co-authored-by: Edward Zarecor <ezarecor@tcril.org>
2023-06-29 10:57:41 -04:00
Braden MacDonald
12a8d99824 feat: Copy/Paste associated static assets along with components (#32346)
* refactor: improve typing of StaticFile named tuple
* feat: copy static asset files into the clipboard
* feat: paste static assets
* feat: show notification in studio about pasted assets
* fix: HTML XBlocks would lose the editor="raw" setting when copy-pasted.
* feat: copy python_lib.zip to the clipboard when it seems to be in use
2023-06-27 12:06:43 -07:00
Agrendalath
5f46ea52cd feat: remove field data binding from the runtime 2023-06-26 19:21:22 +02:00
Zainab Amir
2fd3dc1840 feat: add utm_campaign to registration event (#32574) 2023-06-26 17:05:07 +05:00
Edward Zarecor
0ad7ab30f2 Merge branch 'master' into edx-depr31 2023-06-26 13:02:28 +02:00
Nawfal Ahmed
80d151b404 feat: add marketing url to subscription upsell (#32560) 2023-06-23 12:54:15 +00:00
Yagnesh1998
f0112deb2c feat: Update test_models.py 2023-06-22 15:17:09 +05:30
Zainab Amir
4792f9e792 Revert "feat: send some user traits in successful registration response (#32532)" (#32543)
This reverts commit e30bf391c9.
2023-06-22 13:33:20 +05:00
Agrendalath
71fee4a4a0 feat!: remove block handling from runtime initialization of ReplaceURLService
BREAKING CHANGE: This removes the following deprecated shims from the runtime:
`replace_urls`, `replace_course_urls`, `replace_jump_to_id_urls`. XBlocks need
to use the `replace_urls` service instead.
2023-06-21 20:28:24 +02:00
Syed Sajjad Hussain Shah
e30bf391c9 feat: send some user traits in successful registration response (#32532)
VAN-1499
2023-06-21 13:21:30 +05:00
Ahtisham Shahid
bf4b3c628b refactor: updated api reference from unseen to seen (#32501) 2023-06-21 13:02:28 +05:00
Muhammad Adeel Tajamul
aab3624960 feat: added parser to update existing notification on get (#32450) 2023-06-20 14:10:21 +05:00
SaadYousaf
4c36156c8c feat: add content field property to Notification model 2023-06-20 13:32:52 +05:00
Awais Ansari
8990035116 feat: add notifications mark as read API (#32475)
* feat: add notifications mark as read API

* chore: update description for mark as read notification URL

* refactor: resolve pylint issue

* refactor: notifications mark as read API and test cases

* feat: add translated messages in notificationsAPI response
2023-06-19 18:47:56 +05:00
SaadYousaf
3eab837c0b feat: add management command to generate notification preferences for course 2023-06-19 16:45:28 +05:00
Yagnesh
14f90eba96 feat: BLOCK_STRUCTURES_SETTINGS['PRUNING_ACTIVE'] toggle removed depr31 2023-06-17 02:31:07 +05:30
Mubbshar Anwar
c55f0961ba fix: update event property (#32479)
Update event property name which was added to measure the conversion rate of registration through on ramp experience.

VAN-1478
2023-06-16 09:06:25 +05:00
Jesper Hodge
a6c57811cd feat add xblock api endpoint (#32282)
* feat: add xblock endpoint for updating an xblock

fix: remove debugger

feat: make function call more generic

refactor: just use request.json for request data as before

refactor: extract method

fix: revert wrong method change

fix: refactor correct method

feat: use handle_xblock method so that we can do more than update xblocks

fix: usage_key_string defaults to None

add all CRUD operations

fix usage key parameter

refactor: create /views folder

refactor: move xblock view functions to xblock_services

fix: tests

fix: tests

refactor: move xblock API endpoint to contentstore

* docs: add explanatory comment to new xblock_service

* feat: add feature flag for enabling content editing api

* feat: raise 404 if studio content api is disabled

* tests: test xblock endpoint

* test: make all post tests work

* test: check that xblock_handler receives correct args

* refactor: create util mixin for course factories with staff

* refactor: extract course staff authorization tests

* refactor: extract tests to api view testcase class

* test: add get tests

* test: fix tests

* test: fix tests

* test: fix tests

* test: add all crud tests

* fix: refactor to fix tests

* fix: merge conflict

* fix: merge conflict

* fix: tests after merge

* fix: json request decorator

* fix: lint

* fix: lint

* fix: lint

* fix: lint

* fix: new test files

* fix: lint

* fix: lint and apply PR suggestions

* fix: lint

* fix: lint

* fix: lint

* fix: lint

* fix: lint

* fix: lint
2023-06-15 14:17:49 -04:00
Robert Raposa
e7e4fa3935 temp: remove flaky test_login_and_registration_form_ratelimited (#32459) 2023-06-15 11:43:17 -04:00
Justin Hynes
2f8b7380fb Merge pull request #32463 from openedx/jhynes/APER-2504_changes-part-2
feat: add ability for `notify_credentials` to revoke program certs
2023-06-15 08:25:27 -04:00
Mubbshar Anwar
a62276b8ce feat: registration event property (#32447)
Registration event property to calculate conversion rate through on ramp experience.

VAN-1478
2023-06-15 17:20:43 +05:00
Zainab Amir
d5be2c8033 feat: Get welcome page context (#32426) 2023-06-15 17:09:47 +05:00
ayesha waris
d3b1ce176a feat: adds waffle flag for show notifications tray (#32451)
* feat: adds waffle flag for show notifications tray

* refactor: refactored notifications count api code
2023-06-15 14:38:46 +05:00
Muhammad Faraz Maqsood
65687857d5 enhancement: add support for caching programs for one site (#32380)
* perf!: add support for caching programs on per site bases
2023-06-15 11:29:22 +05:00
Justin Hynes
2beaa1d260 feat: add ability for notify_credentials to revoke program certs
[APER-2504]

This is a companion to PR #32458. This updates the `notify_credentials` management command and adds an additional argument/switch (`--revoke_program_certs`).

If included, this option will be converted to a boolean and passed as a script option. Eventually, the `send_notifications` function (updated in the previously mentioned PR) will determine if we should fire a signal that checks if any program certs need to revoked.
2023-06-14 19:29:55 +00:00
Justin Hynes
d427d404da feat: add ability for notify_credentials to revoke program certs
[APER-2504]

This PR adds additional functionality to the tasks kicked off when the `notify_credentials` management command is run.

I have added a new keyword arg (revoke_program_certs) that, if True, will check to see if we need to revoke a program certificate. This functionality was introduced to help automate fixing cases where a learner still has access to a Program Certificate even if they have been awarded all of the course certificates in a Program (see APER-2499).

The functionality has to be committed in two separate PRs because of our blue/green deployments. The task changes will come first, then we will update the management command to be able to set/pass the new settings. New settings were added as keyword args (defaulting to False) in order to ensure that we won't trip up our workers.
2023-06-14 16:29:43 +00:00
Kaustav Banerjee
489e23983f feat: tpa automatic logout (#32193)
* feat: tpa automatic logout

* chore: modify toggle documentations

* chore: check TPA_AUTOMATIC_LOGOUT_ENABLED in _show_tpa_logout_link

* docs: modify method doc
2023-06-14 17:01:00 +05:00
muhammad-ammar
2a24bf8c4f chore: add comment 2023-06-13 19:40:06 +05:00
Muhammad Bilal Tahir
8693d5a4a6 feat: create user profile if not found in current job command 2023-06-13 17:07:17 +05:00
Awais Ansari
52a886d456 feat: filter notifications based on NOTIFICATIONS_EXPIRY (#32411)
* feat: add 2 months limit in notifications list API

* chore: add NOTIFICATIONS_MAX_DAYS in lms settings

* refactor: update NOTIFICATIONS_MAX_DAYS to NOTIFICATIONS_EXPIRY

* feat: add order_by reverse id in notificationslist API
2023-06-13 17:05:18 +05:00
muhammad-ammar
2ecd06a735 feat: trigger signals to import and delete course details from plugin 2023-06-12 18:31:57 +05:00
Nawfal Ahmed
6a5c1bbf44 feat: update subscription enrollment alert (#32414) 2023-06-12 13:07:43 +00:00
Muhammad Bilal Tahir
86edbbeb46 feat: management command to fetch enterprise current job in lms extended profile 2023-06-07 15:17:10 +05:00
SaadYousaf
2da176ce32 feat: implementing basic functionality to incorporate new notification types 2023-06-07 14:05:59 +05:00
SaadYousaf
0339784e4e feat: integrating notification preference API 2023-06-07 14:05:59 +05:00