Commit Graph

37 Commits

Author SHA1 Message Date
Feanil Patel
88c7cd7bf3 feat!: Remove Legacy Preview Functionality (#36460)
* feat!: Remove all trivial mentions of PREVIEW_LMS_BASE

There are a few more mentions but these are all the ones that don't need
major further followup.

BREAKING CHANGE: The learning MFE now supports preview functionality
natively and it is no longer necessary to use a different domain on the
LMS to render a preview of course content.

See https://github.com/openedx/frontend-app-learning/issues/1455 for
more details.

* feat: Drop the `in_preview_mode` function.

Since we're no longer using a separate domain, that check always
returned false.  Remove it and update any places/tests where it is used.

* feat: Drop courseware_mfe_is_active function.

With the removal of the preview check this function is also a no-op now
so drop calls to it and update the places where it is called to not
change other behavior.

* feat!: Drop redirect to preview from the legacy courseware index.

The CoursewareIndex view is going to be removed eventually but for now
we're focusing on removing the PREVIEW_LMS_BASE setting.  With this
change, if someone tries to load the legacy courseware URL from the
preview domain it will no longer redirect them to the MFE preview.

This is not a problem that will occur for users coming from existing
studio links because those links have already been updated to go
directly to the new urls.

The only way this path could execute is if someone goes directly to the
old Preview URL that they saved off platform somewhere.  eg. If they
bookmarked it for some reason.

BREAKING CHANGE: Saved links (including bookmarks) to the legacy preview
URLs will no longer redirect to the MFE preview URLs.

* test: Drop the set_preview_mode test helper.

This test helper was setting the preview mode for tests by changing the
hostname that was set while tests were running.  This was mostly not
being used to test preview but to run a bunch of legacy courseware tests
while defaulting to the new learning MFE for the courseware.

This commit updates various tests in the `courseware` app to not rely on
the fact that we're in preview to test legacy courseware behavior and
instead directly patches either the `_redirect_to_learning_mfe` function
or uses the `_get_legacy_courseware_url` or both to be able to have the
tests continue to test the legacy coursewary.

This will hopefully make the tests more accuarte even though hopefully
we'll just be removing many of them soon as a part of the legacy
courseware cleanup.

We're just doing the preview removal separately to reduce the number of
things that are changing at once.

* test: Drop the `_get_urls_function`

With the other recent cleanup, this function is no longer being
referenced by anything so we can just drop it.

* test: Test student access to unpublihsed content.

Ensure that students can't get access to unpublished content.
2025-05-14 08:59:11 -04:00
Deborah Kaplan
e7771d6526 fix: catch a possible exception in beta course configuration (#36172)
* fix: catch a possible exception in beta course configuration

when the learner is a beta tester, and the beta test has been set up with a large duration, the courseware djangoapp can return an overflow error on a timedelta call. In those circumstances, this defaults to returning an unmodified date.

FIXES: APER-3848
2025-01-27 13:59:02 -05:00
Troy Sankey
2cb35cb24b fix: remove setting toggle which might be causing bug with future course redirects
We've long rolled out the
`COURSEWARE_COURSE_NOT_STARTED_ENTERPRISE_LEARNER_ERROR` setting toggle so
it should be safe to remove.

I'm completely at a loss as to why course access checks are not
returning the `course_not_started_enterprise_learner` error code when it
should, but it does in stage/local, so this PR is grasping at straws.

ENT-8766
2024-05-03 11:15:59 -07:00
Troy Sankey
9ef8ce61e6 feat: wrap new course_not_started_enterprise_learner in a SettingToggle
ENT-8078
2023-12-18 18:54:36 -08:00
Troy Sankey
499679ab6c feat: add new course access error_code for enterprise learners in future courses (2nd try)
Normally, the course API would return an access error_code of
`course_not_started` if the course has not started yet.  This change
breaks that up into two codes:

* if the course has not started:
  * return error_code=`course_not_started_enterprise_learner` if the
    learner is enrolled as a subsidized enterprise learner.
  * else, return error_code=`course_not_started`.

This supports a change to the frontend which will interpret
`course_not_started_enterprise_learner` differently and trigger a
redirect to the enterprise (B2B) learner dashboard instead of the B2C
dashboard.

ENT-8078
2023-12-18 12:55:17 -08:00
Troy Sankey
0ea0048bdf revert: "feat: add new course access error_code for enterprise learners in future courses"
This reverts commit 287a7ff7fd.
2023-12-15 10:49:46 -08:00
Troy Sankey
287a7ff7fd feat: add new course access error_code for enterprise learners in future courses
Normally, the course API would return an access error_code of
`course_not_started` if the course has not started yet.  This change
breaks that up into two codes:

* if the course has not started:
  * return error_code=`course_not_started_enterprise_learner` if the
    learner is enrolled as a subsidized enterprise learner.
  * else, return error_code=`course_not_started`.

This supports a change to the frontend which will interpret
`course_not_started_enterprise_learner` differently and trigger a
redirect to the enterprise (B2B) learner dashboard instead of the B2C
dashboard.

ENT-8078
2023-12-14 22:18:25 -08:00
0x29a
0df1411636 refactor: xmodule/course_module.py -> xmodule/course_block.py 2022-12-19 17:48:49 +01:00
hammadahmadwaqas
02c799df61 feat: added support to check if active enterprise is same as EnterpriseCourseEnrollment object. 2022-09-07 11:24:33 +05:00
hammadahmadwaqas
7607303b79 feat: added support to check for DSC in course-home:course-metadata view. 2022-07-19 17:43:01 +05:00
Mohammad Ahtasham ul Hassan
22e510d69b fix: remove logging (#30559) 2022-06-08 20:31:52 +05:00
connorhaugh
ab59796a56 fix: python-dateutil version issue 2022-06-07 14:33:44 +05:00
Jawayria
abd4cdc819 chore: Applied lint-amnesty on lms/djangoapps/courseware 2021-12-02 15:08:55 +05:00
Usama Sadiq
859df03049 refactor: ran pyupgrade on lms/djangoapps/courseware (#26737) 2021-03-12 12:15:58 +05:00
Jawayria
a383845b01 BOM-2352: Removed unused imports from lms/djangoapps/{course_blocks, course_goals, course_home_api, courseware} 2021-02-22 21:44:42 +05:00
Jawayria
03e6a874d0 Applied pylint-amnesty to courseware 2021-02-03 21:56:24 +05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Jeff LaJoie
efa7b3b816 AA-164: Performance fixes for course home 2020-05-20 10:09:41 -04:00
David Joy
7a400e2917 Factoring redirects out of check_course_access so it can be used with courseware_api (#23651)
TNL-7053

The courseware_api view will use check_course_access - which now returns AccessResponse objects, and all other uses of check_course_access will now use check_course_access_with_redirect, which is a drop-in replacement for the original check_course_access implementation.

We also added a few new helpers to access_utils:

- check_public_access is a replacement for allow_public_access, which now returns AccessResponse objects
 - check_enrollment checks if the learner is enrolled, and uses check_public_access to account for COURSE_ENABLE_UNENROLLED_ACCESS_FLAG
- check_survey checks whether there is a required survey that the learner must complete prior to accessing the course.

There are two new kinds of AccessError subclasses:

- SurveyRequiredAccessError
- EnrollmentRequiredAccessError
2020-04-15 10:29:24 -04:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Ned Batchelder
efba6e45e8 Finally import courseware properly everywhere to get rid of a warning 2019-09-26 09:40:15 -04:00
Ayub khan
af2e7705b1 INCR-434 python3 compatibility 2019-07-16 15:54:54 +05:00
Calen Pennington
755a5c7db6 Augment content_type_gating tests to detect the failure case from the original REVMI-34 implementation 2019-05-16 15:17:33 -04:00
Matthew Piatetsky
6e81c84d8b fix unicode strings in lms/ part 1 2019-02-05 15:15:02 -05:00
Matthew Piatetsky
9ba3e0c5a5 ensure content start date banner only shows for currently open sections 2019-01-17 12:32:08 -05:00
Matthew Piatetsky
5bb56fe45f add informational banners when masquerading as user who would not have access due to start date 2019-01-10 11:06:30 -05:00
Matthew Piatetsky
fc6cc94573 Ensure masquerade works in courses that haven't started yet 2018-12-19 08:43:54 -05:00
noraiz-anwar
593c2d1ae8 add python getter in capa system 2018-07-18 18:44:56 +05:00
Adeel Khan
5a730aa934 Improve CourseListView end point latency by removing CourseWaffleFlag.
This patch would remove CourseListView slow transaction by changing
CourseWaffleFlag to WaffleFlag. This removes extra hit on
WaffleUtil's model (WaffleFlagCourseOverrideModel).

LEARNER-5566
2018-07-13 16:09:05 +05:00
John Eskew
7dfb6cc681 Change all UTC timezones to import from pytz instead of Django. 2017-10-05 11:12:52 -04:00
Andy Armstrong
aeecf34387 Enable conditional pre-start-date access to courses
LEARNER-1854
2017-07-14 14:00:48 -04:00
Andy Armstrong
79acb5c5be Reorder LMS imports using isort 2017-06-11 21:48:06 -04:00
Diana Huang
3e71a45349 Only show preview bar if student can view it. 2017-05-18 09:16:28 -04:00
Ehtesham
5ad2eb300c [TNL-4073][TNL-4273] Make sure that domain defined for preview exists in
HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS,
2016-03-23 18:52:32 +05:00
Awais Jibran
5899be9207 Fix Beta Testers access courseware in self-paced courses
ECOM-3612
2016-02-10 14:47:03 +05:00
Nimisha Asthagiri
95fdbd981c Refactor has_access for re-usability. 2015-10-26 16:26:41 -04:00