Commit Graph

19775 Commits

Author SHA1 Message Date
Mushtaq Rossier
eb2b51d02e feat: Added extra info logs for refundable method 2024-06-05 12:40:01 +02:00
Kyle D. McCormick
97a9f08a9f build: lms/static/css/vendor/* -> common/static/css/vendor
The git-ignored target directory for LMS Sass compilation is:
    lms/static/css

Unfortunately, that directory contains git-controlled directory of
vendored-in static assets:
    lms/static/css/vendor

This is a problem for a couple reasons:

1. In Tutor, we would like to make lms/static/css a symlink to an
   external location for the sake of build efficiency. This is
   impossible to do without clobbering lms/static/css/vendor and
   dirtying the git state.

2. More generally, when optimizing (or just understanding) a build
   system, it adds complexity when git-controlled source directories are
   mixed up inside git-ignored target directories.

The solution is to simply merge these vendored-in assets to another
existing git-controlled vendor directory:
    common/static/css/vendor

LMS already reads assets from this folder, so no further changes need to
be made. common/static/css is fully git-controlled, so we avoid the
complexity described above.
2024-06-04 11:48:58 -04:00
sohailfatima
17f48adb49 feat: remove unnecessary PII 2024-06-04 12:08:52 +05:00
sohailfatima
8e7a5f18c7 feat: added tracking events for password reset initiation 2024-06-04 12:08:52 +05:00
feanil
0495378896 chore: geoip2: update maxmind geolite country database 2024-06-01 03:07:04 +00:00
Kyle McCormick
ccf2b75204 fix: stabilize makemigrations when SITE_ID != 1 (#34787)
Some models in third_party_auth used settings.SITE_ID as a field
default, which caused Django to say migrations were out of sync whenever
settings.SITE_ID happened to be anything other than 1 for any developer:

    Your models in app(s): 'third_party_auth' have changes that are not
    yet reflected in a migration, and so won't be applied. Run
    'manage.py makemigrations' to make new migrations, and then re-run
    'manage.py migrate' to apply them.

This could easily happen if a developer is testing out site
configuration or site-specific theming and ends up with a SITE_ID other
than 1.

The fix, inspired by a StackOverflow answer [1], is to simply create
a wrapper function for the dynamic default value. The wrapper function,
rather than the current value of SITE_ID, will be serialized to the
migraiton file.

This commit includes a migration file, but from a database perspective,
the migration is a no-op.

[1] https://stackoverflow.com/a/12654998
2024-05-22 13:52:53 -04:00
Kyle McCormick
11626148d9 refactor: switch from mock to unittest.mock (#34844)
As of Python 3.3, the 3rd-party `mock` package has been subsumed into the
standard `unittest.mock` package. Refactoring tests to use the latter will
allow us to drop `mock` as a dependency, which is currently coming in
transitively through requirements/edx/paver.in.

We don't actually drop the `mock` dependency in this PR. That will happen
naturally in:

* https://github.com/openedx/edx-platform/pull/34830
2024-05-22 13:52:24 -04:00
Jesper Hodge
e95d7e7e32 fix: libraries performance problem
This is an attempt to fix a performance problem on the libraries home page. When you go to studio home and click on the libraries tab, on prod it will be quick for admins but extremely slow for course instructors (> 12 seconds) and leads to timeouts. It grows with the number of libraries that are assigned to the instructor.

The Python code for the request to load libraries for a particular user goes through all existing libraries and then checks all of the user's roles for each library, which results in a complexity of O(l*r), l=libraries, r=roles. This PR improves the complexity to O(l).

The BulkRoleCache and RoleCache classes were using a python set to store all roles for a particular user. A user can have a large number of roles, and lookup speed of iterating through a set is slow (O(n)). Most roles don't have the same course id, however. So if you have the course id of the role you're looking for, we can use a dict of course ids that contain related roles. The number of roles per course id is negligible, so we arrive at a lookup speed of O(1) when looking up a user's roles that belong to a specific course id.

The BulkRoleCache now caches and stores user roles in a data structure like this:
    {
        user_id_1: {
            course_id_1: {role1, role2, role3},  # Set of roles associated with course_id_1
            course_id_2: {role4, role5, role6},  # Set of roles associated with course_id_2
            [ROLE_CACHE_UNGROUPED_ROLES_KEY]: {role7, role8}  # Set of roles not tied to any specific course or library. For example, Global Staff roles.
        },
        user_id_2: { ... }  # Similar structure for another user
    }

While this changes the data structure used to store roles under the hood and adds the new property `roles_by_course_id` to the RoleCache,
when initializing the RoleCache will store roles additionally in the previous data structure - as a flat set - in the `_roles` property accessible via `all_roles_set`. This establishes
backwards compatibility.

We are now storing roles twice in the RoleCache (in each of the two data structures), which means this takes twice as much memory, but only in the scope of a request.
2024-05-20 16:34:08 -04:00
Glenn R. Martin
20c8fc127b fix: logging emission of REFUND_ORDER 2024-05-17 11:55:47 -04:00
Kyle McCormick
15caa9746f refactor: Completely remove Blockstore (#34739)
Blockstore and all of its (experimental) functionality has been replaced with
openedx-learning, aka "Learning Core". This commit uninstalls the now-unused
openedx-blockstore package and removes all dangling references to it.

Note: This also removes the `copy_library_from_v1_to_v2` management command,
which has been broken ever since we switched from Blockstore to Learning Core.

Part of this DEPR: https://github.com/openedx/public-engineering/issues/238
2024-05-13 09:48:18 -04:00
feanil
967e1c5751 chore: geoip2: update maxmind geolite country database 2024-05-03 14:13:33 +00:00
Feanil Patel
ff48125859 Merge pull request #34503 from brian-smith-tcril/revert-revert-node-18
revert: revert: "chore: upgrade to node 18" (#34496)
2024-04-23 10:13:07 -04:00
Muhammad Anas
aea7fcee45 feat: added feature flag to enable blake2b hashing 2024-04-22 14:09:41 -04:00
Brian Smith
14b113c518 chore: remove CommonsChunk plugin karma workaround 2024-04-19 14:03:42 -04:00
Jillian
d67211051b feat: restrict Studio search results based on user permissions (#34471)
* feat: adds SearchAccess model

Stores a numeric ID for each course + library, which will generally be
shorter than the full context_key, so we can pack more of them into the
the Meilisearch search filter.

Also:

* Adds data migration pre-populates the SearchAccess model from the existing
  CourseOverview and ContentLibrary records
* Adds signal handlers to add/remove SearchAccess entries when content
  is created or deleted.
* Adds get_access_ids_for_request() helper method for use in views.
* Adds tests.

* test: can't import content.search in lms tests

* feat: use SearchAccess in documents and views

* Adds an access_id field to the document, which stores the
  SearchAccess.id for the block's context.
* Use the requesting user's allowed access_ids to filter search results
  to documents with those access_ids.
* Since some users have a lot of individual access granted, limit the
  number of access_ids in the filter to a large number (1_000)
* Updates tests to demonstrate.

* test: can't import content.search or content_staging in lms tests

* fix: make access_id field filterable

* fix: use SearchAccess.get_or_create in signal handlers

In theory, we shouldn't have to do this, because the CREATE and DELETE
events should keep the SearchAccess table up-to-date.

But in practice, signals can be missed (or in tests, they may be
disabled). So we assume that it's ok to re-use a SearchAccess.id created
for a given course or library context_key.

* refactor: refactors the view tests to make them clearer

Uses helper methods and decorators to wrap the settings and patches used
by multiple view tests.

* feat: adds org filters to meilisearch filter

* Uses content_tagging.rules.get_user_orgs to fetch the user's
  content-related orgs for use in the meilisearch filter.
* Limits the number of orgs used to 1_000 to keep token size down

* refactor: removes data migration

Users should use the reindex_studio management command to populate SearchAccess.

* refactor: adds functions to common.djangoapps.student.role_helpers

to allow general access to the user's RoleCache without having to access
private attributes of User or RoleCache.

Related changes:

* Moves some functionality from openedx.core.djangoapps.enrollments.data.get_user_roles
  to this new helper method.
* Use these new helper method in content_tagging.rules

* fix: get_access_ids_for_request only returns individual access

instead of all course keys that the user can read.

Org- and GlobalStaff access checks will handle the rest.

* fix: use org-level permissions when generating search filter

Also refactors tests to demonstrate this change for OrgStaff and
OrgInstructor users.

* refactor: remove SearchAccess creation signal handlers

Lets SearchAccess entries be created on demand during search indexing.

* feat: omit access_ids from the search filter that are covered by the user's org roles

---------

Co-authored-by: Rômulo Penido <romulo.penido@gmail.com>
2024-04-17 11:21:34 -07:00
Troy Sankey
f30ae71c23 feat: add more verbose logging around force_enrollment
After testing the enterprise bulk enrollment flow with
force_enrollment=True, I'm finding that the enrollment is still not
forced. This extra logging will hopefully help shed light on where this
boolean might be accidentally ignored.
2024-04-15 08:21:35 -07:00
Stanislav Lunyachek
cfcd526d2b fix: Space around techers images on course about page 2024-04-10 23:14:01 +03:00
Omar Al-Ithawi
5a437779d9 fix: add fallback gettext function if translations aren't pulled in dev envs (#34416) 2024-03-27 13:20:12 -04:00
Omar Al-Ithawi
83f448778a feat!: atlas pull for studio-frontend translations (#34261)
This pull request pulls translations via atlas for `studio-frontend` and refactor `load_sfe_i18n_messages` to load new translations into `conf/plugins-locale/studio-frontend` instead of relying on deprecated node.js package bundled translations.
2024-03-06 15:50:59 +00:00
Zainab Amir
383f5d636a feat: update account verification email context (#34294) 2024-02-27 03:20:15 -08:00
Attiya Ishaque
3a05fd20c6 refactor: Remove unused code for merchandising 2U LOBs (#34230) 2024-02-20 14:03:10 +05:00
Mubbshar Anwar
9fd5157577 fix: update activation email (#34136)
update account activation email message copy in body

VAN-1800
2024-02-20 11:48:50 +05:00
Attiya Ishaque
16e0333da9 refactor: remove the managment command populate user emails on braze (#34228) 2024-02-14 17:54:34 +05:00
Zachary Hancock
2f2ed4d6cb feat: send course role events to the event bus (#34158)
Notify the event bus when a user's role in a course is added or removed
2024-02-13 13:16:23 -05:00
salmannawaz
57b480b04f Update all edx-platform REST endpoints to support JWT Auth (#34152)
* chore: update API endpoints to support default JWT auth

The default DRF Auth classes were recently updated to allow for both JWT and Session auth by default. Any endpoint that overrides the AUTHENTICATION_CLASSES but has just session, just JWT or just both of those should be updated to remove the override.

Details in https://github.com/openedx/edx-platform/issues/33662
2024-02-13 10:46:58 -05:00
Jenkins
ab6793ef29 chore: geoip2: update maxmind geolite country database 2024-02-07 15:59:31 -05:00
Nathan Sprenkle
7037c8d27b feat: remove rollout percentage code for learner home (#34198)
This code allowed us to control rollout but is no longer needed.
2024-02-07 15:27:57 +00:00
Feanil Patel
e6333d0c3d Merge pull request #33922 from Zeit-Labs/plugins-i18n
feat: atlas pull plugins translation | FC-0012
2024-02-01 13:07:32 -05:00
Jenkins
abb4b0e37c chore: geoip2: update maxmind geolite country database 2024-01-31 15:59:29 -05:00
Leangseu Kim
206ddd11ad chore: revert change to Mathjax 2024-01-31 10:05:33 -05:00
Syed Sajjad Hussain Shah
cb2a34e51f feat: logout other sessions on email change (#33846)
* feat: logout other sessions on email change

* fix: updated the approach for session invalidation

* fix: update and add tests

* fix: update tests with descriptive comments

* feat: add integration tests

* fix: store email in session update

* fix: add setting for tests

* fix: fix tests

* feat: Upgrade Python dependency edx-drf-extensions (#34135)

Commit generated by workflow `openedx/edx-platform/.github/workflows/upgrade-one-python-dependency.yml@refs/heads/master`

Co-authored-by: syedsajjadkazmii <syedsajjadkazmii@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: syedsajjadkazmii <syedsajjadkazmii@users.noreply.github.com>
2024-01-29 14:43:51 +05:00
Omar Al-Ithawi
867eeff993 feat: atlas pull plugins translation 2024-01-27 12:05:05 +03:00
Brian Beggs
c0e7fb7276 chore: Upgrade the jquery cookie library. 2024-01-24 16:54:58 -05:00
Jenkins
2bf6ffaaf1 chore: geoip2: update maxmind geolite country database 2024-01-24 15:59:35 -05:00
Justin Hynes
426ee163bc revert: add brand_color variable for the email templates (#33421)"
This reverts commit 4ec70eb98b.

This commit introduced a new setting (`brand_color`) that does not appear to be set and is causing issues with account deletion and other parts of the courseware.

Reverting until we can understand the change better.
2024-01-24 18:47:02 +00:00
bydawen
4ec70eb98b feat: add brand_color variable for the email templates (#33421)
* feat: add brand_color variable for the email templates

* test: fix tests assertations

---------

Co-authored-by: Eugene Dyudyunov <evgen.dyudyunov@raccoongang.com>
2024-01-23 13:21:06 +05:00
Jenkins
11cbf0d6f7 chore: geoip2: update maxmind geolite country database 2024-01-17 15:59:24 -05:00
Omar Al-Ithawi
a5251cc705 feat: atlas pull for XBlock translations 2024-01-12 12:49:46 +03:00
Jenkins
e3927bd34e chore: geoip2: update maxmind geolite country database 2024-01-10 15:59:21 -05:00
Jenkins
13ff28eb62 chore: geoip2: update maxmind geolite country database 2024-01-03 15:59:20 -05:00
Jenkins
67803456f0 chore: geoip2: update maxmind geolite country database 2023-12-27 15:59:16 -05:00
Jenkins
9a97ea78d9 chore: geoip2: update maxmind geolite country database 2023-12-20 15:59:16 -05:00
Zainab Amir
c233327ea0 feat: remove unused recommendations code (#33960) 2023-12-20 16:56:39 +05:00
Jenkins
4453f27213 chore: geoip2: update maxmind geolite country database 2023-12-13 16:04:13 -05:00
Jenkins
d2fd7b2e1f chore: geoip2: update maxmind geolite country database 2023-12-06 15:59:10 -05:00
Jenkins
e95b40e266 chore: geoip2: update maxmind geolite country database 2023-11-29 15:59:05 -05:00
Awais Qureshi
9d959c7d33 build: upgrading babel. (#33778)
* build: upgrading babel.
2023-11-27 16:37:35 +05:00
Mohammad Ahtasham ul Hassan
a57dd7325b feat: add course key param to track selection url (#33716) 2023-11-24 15:23:36 +05:00
Jenkins
4529d6f105 chore: geoip2: update maxmind geolite country database 2023-11-22 15:59:03 -05:00
Jenkins
c5cbb96a48 chore: geoip2: update maxmind geolite country database 2023-11-20 13:10:50 -05:00