Commit Graph

9339 Commits

Author SHA1 Message Date
Diana Huang
29548459fa refactor: Remove PyContracts usage. (#27887)
* refactor: Remove PyContracts usage.

We have not used PyContracts in a while and it is overhead we don't
need in edx-platform.

https://openedx.atlassian.net/browse/DEPR-147

* chore: Updating Python Requirements (#28018)

Co-authored-by: edX requirements bot <49161187+edx-requirements-bot@users.noreply.github.com>
2021-06-23 18:24:06 -04:00
Régis Behmo
b1eaf9c7f8 refactor: remove deprecated mongodb client class
As of pymongo 3.0, the MongoReplicaSetClient is deprecated in favour of
MongoClient. Thus, the creation of mongodb clients is simplified.

See: https://pymongo.readthedocs.io/en/stable/changelog.html#mongoclient-changes
2021-06-14 09:42:34 -04:00
Ihor Romaniuk
06c542dfa0 [BD-26] feat: add temporary waffle flag for enabling disabling proctored exams (#27810)
* feat: [BD-26] add the is_proctored value to SequenceMetadata API

* feat: add temporary flag for enabling/disabling proctored exams

* fix: change creation date

* fix: fix text indents

* fix: [BD-26] Remove redundant duplicated test.

Co-authored-by: Sagirov Eugeniy <sagirov19@gmail.com>
Co-authored-by: Igor Degtiarov <igor.degtiarov@raccoongang.com>
2021-06-11 10:04:11 -04:00
Bianca Severino
58d5b29f19 fix: convert integrity signature waffle flag to CourseWaffleFlag 2021-06-09 13:19:17 -04:00
Kyle McCormick
de8859584f Merge pull request #27874 from edx/kdmccormick/xmodule-no-cms
refactor: make xmodule & openedx independent of code in cms

The xmodule and openedx packages both contain code that is common
between LMS and CMS. The cms package is, of course,
contains CMS-specific code.

So, one prerequisite to extracting CMS into an independent service
will be making sure that lms, common, openedx, and the projects in
common/lib (xmodule, capa, etc.) are not coupled to any CMS-specific
features. This PR moves us towards that reality by making sure
that those packages are independent from cms from a Python-import
perspective, at least.
2021-06-09 09:15:31 -04:00
Christie Rice
e7900160e8 test: Remove flaky test (#27885)
CR-3732
2021-06-08 15:07:23 -04:00
Kyle McCormick
7a26ec6b92 refactor: move xml_importer-specific exceptions into xml_importer
This is a minor refactoring in order to remove
a code dependency of ./xmodule on ./cms
2021-06-08 10:46:52 -04:00
Kyle McCormick
c1e79c993e refactor: use handler_url from xblock runtime, not cms
This is a minor refactoring in order to remove
a code dependency of ./xmodule on ./cms
2021-06-08 10:46:52 -04:00
Kyle McCormick
d42b0c401d refactor: normalize xmodule imports
Code in ./common/lib/xmodule/xmodule should
be imported as `from xmodule`, since `xmodule`
is a locally-installed package.

This is weird, but as long as it is the case,
we should be consistent.

(In BOM-2584, I propose moving the files to
 ./xmodule, which would quell this confusion.)
2021-06-07 16:36:38 -04:00
Bianca Severino
f19582a67c Merge pull request #27831 from edx/bseverino/proctoring-integrity-signature-check
[MST-838] Pass integrity signature waffle flag to timed exam view
2021-06-04 11:26:05 -04:00
Bianca Severino
f7aee7a900 fix: pass integrity signature waffle flag to timed exam view 2021-06-03 15:28:39 -04:00
Michael Terry
6a41c61adc fix: don't escape assignment names in grades API
We had been pre-escaping display names like 'Math & Science' as
'Math &amp; Science" in the REST API itself - which meant that
consumers like MFEs that do their own escaping displayed the wrong
thing.

It's better for the API to just leave the string as-is. As far as
I know, this only affects the gradebook and progress pages, both
of which do their own escaping of the result from the API already.

AA-808
2021-06-03 11:11:07 -04:00
Simon Chen
ce6087f546 [Chore]:MST-677 Cleanup the waffle flag to roll out Proctoring Improvements (#27657) 2021-05-17 20:46:24 -04:00
jawad khan
17906d6770 feat: Add multi device support for mobile in word cloud (#27386)
Enable mobile support on word cloud xblock

LEARNER-8319
2021-05-17 07:49:33 +05:00
Michael Terry
71a8a9fb56 fix: make 'conditional' xblocks work again after being broken
I accidentally broke them in commit b90039b2 by passing in an
extra argument to display.js constructors.

TNL-8318
2021-05-14 10:09:27 -04:00
Michael Terry
1e4daf749c Merge pull request #27594 from edx/mikix/youtube-complete
fix: mark age-restricted youtube videos as complete immediately
2021-05-11 14:53:08 -04:00
Michael Terry
c7fd535c2f fix: mark age-restricted youtube videos as complete immediately
Youtube videos that are age-restricted must be viewed on youtube
itself rather than in the embedded player. So we can't notice when
the video is watched. Rather than leave it incompletable, just mark
the video complete immediately if it's restricted.

AA-804
2021-05-11 13:58:03 -04:00
Kyle McCormick
680bd32de8 revert: refactor: pyupgrade second iteration (#27591)
The edx-sandbox (secure/codejailed execution context
for edx-platform) still runs in Python 3.5, so certain
modules in common/lib cannot be py-upgraded to use
Python 3.8 syntax.

Specifically, this commit added an f-string to
common/lib/sandbox-packages/verifiers/draganddrop.py,
which broke scoring of deprecated drag-and-drop problems
in codejail.

TNL-8322

This reverts commit 8c06b68bbe
2021-05-11 10:53:49 -04:00
Usama Sadiq
4f4be6538a BOM-2477: pylint warnings lint-amnesty (#27585) 2021-05-11 17:22:40 +05:00
Usama Sadiq
8c06b68bbe refactor: pyupgrade second iteration (#27451) 2021-05-10 13:46:28 +05:00
Usama Sadiq
e66e43c5d2 refactor: pyupgrade second iteration (#27450) 2021-05-10 13:42:51 +05:00
Michael Terry
78c6be8bee Merge pull request #27422 from edx/mikix/handler-will-recheck-access
fix: the get_completion JS handler should not ignore FBE blocks
2021-05-04 15:54:36 -04:00
Michael Terry
6e52aafc8c fix: properly set contains_gated_content field on xblocks again
This has been broken for a couple months, preventing proper display
of verified-only assignments on the dates tab and elsewhere.

AA-780
2021-05-03 10:17:17 -04:00
David Ormsbee
dfb80acc11 feat: Enrollment Tracks OutlineProcessor (MST-685)
NOTE: This will require a forced backfill of course outlines to update
the course content data in learning_sequences:

  python manage.py cms backfill_course_outlines --force

Without this backfill, the learning_sequences API will continue to serve
stale content data that has no user partition group data. It won't cause
errors, but it won't do the exclusions properly.

Commit summary:

* Created EnrollmentTrackPartitionGroupsOutlineProcessor to process the
  enrollment_track User Partition Group, allowing Sequences and Sections
  to be removed based on their group_access settings.
* Added user_partition_groups attribute to CourseLearningSequenceData
  and CourseSectionData in learning_sequences/data.py, along with
  backing model data.
* get_outline_from_modulestore now extracts group_access settings from
  Sections and Sequences. It also bubbles up group_access settings from
  Units, meaning that if a Sequence with no group_access setting has
  Units that are all set to show only to the Verified enrollment track,
  then the Sequence will only show to the Verified enrollment track.

This commit adds model-level support for all user partition groups by
capturing all the content group associations (group_access), but it only
implements the code checks for the enrollment track partition. It's not
clear that we want to generalize, since there's only one other partition
type (A/B testing) that is applicable at the outline level.

It's important to note that there is no way to set the group_access for
a Section or Sequence in Studio today. It's only possible by direct
editing of the OLX for import. That being said, the block structures
framework supports applying course groups at this level, and this commit
moves learning_sequences closer to feature parity.

The bubbling up from Units to the parent Sequence was done to mitigate
confusion when a Sequence is entirely composed of Units that are not
visible to the user because of content group restrictions. It's not
clear whether this is something we want to do in the long term, since it
would simplify the code to always specify group_access at the Sequence
level. This first pass is done partially to collect better data about
places in our courses where this kind of usage is already happening.

Most of the EnrollmentTrackPartitionGroupsOutlineProcessor code and its
tests were written by @schenedx.
2021-04-28 12:58:59 -04:00
Michael Terry
b90039b23d fix: the get_completion JS handler should not ignore FBE blocks
Because xblock handlers normally get a block tree that already has
inaccessible blocks stripped, they don't see FBE gated blocks at
all. So the get_completion handler would return True for FBE units
incorrectly. Leading to a visual bug as an audit user went through
their units in the courseware.

In order to let the handler know about the full tree, I've added a
new attribute you can set on your xblock handlers:
my_handler.will_recheck_access = True

This will tell the top-level handler code get the full tree for you.

As part of this, I've also changed the sequence xblock handler's
into proper xblock handlers (not old-style xmodule handlers).
This changes their URLs slightly. I've kept the old URLs for now
as well, but they'll be removed after Maple.

AA-409
2021-04-27 15:17:53 -04:00
Dillon Dumesnil
8c18242ecb fix: AA-646: Fix is_staff_user check to check for course staff
It was checking for global staff, but really only needed to check
for course staff. This corrects the check.
2021-04-23 10:24:53 -04:00
Kyle McCormick
b0d41f6ebb refactor: simplify ProblemBlock inheritance hierarchy (#27363)
Previously, ProblemBlock's implementation was split between
CapaMixin/CapaFields (in capa_base.py) and ProblemBlock
(in capa_module.py), the former being the base classes of the
latter. The split existed for a historical reason:
as a former XModule, ProblemBlock was once split
between CapaDescriptor (author-facing) and CapaModule
(learner-facing). Since ProblemBlock has been converted
to being a pure XBlock, the division between the base
classes and the block class are no longer necessary
nor semantically helpful.

docs: Flesh out ProblemBlock's docstring a bit.
2021-04-22 12:44:15 -04:00
Ali Akbar
025fb5ed66 Merge pull request #228 from edx/aakbar/xss-security-fixes
Fix XSS for numerous files
2021-04-22 01:16:47 +05:00
Julia Eskew
efa13ff1d2 fix: TNL-8233: Change exception raised at problem creation failure from generic exception to LoncapaProblemError. (#27361)
Raising this specific exception will cause the failure to be handled more gracefully by problem rescoring code.
2021-04-21 16:13:23 -04:00
Usama Sadiq
2b55959a8e refactor: apply lint-amnesty on existing violations 2021-04-20 23:51:31 +05:00
Awais Jibran
62c8805e3e Refactor + Tests: Course Import Feature (#27369)
* Code Refactoring
This PR bumps code coverage by adding unit tests & clean up some code for improving code quality and maintainability.
2021-04-19 23:49:42 +05:00
Saad Yousaf
bb3be323f0 [TNL-8235] - Fix breaking code by updating the exception when load_file fails. (#27368)
Co-authored-by: SaadYousaf <saadyousaf@A006-00314.local>
2021-04-19 13:30:14 +05:00
Ahtisham Shahid
b73c0f0a90 Refactored InvalidProctoringProvider exception code (#27366) 2021-04-19 11:54:58 +05:00
Ali-D-Akbar
643d5211ca refactor: fix xss PROD-2305 2021-04-16 14:09:16 +05:00
Ahtisham Shahid
58231c4262 Moved Import error messages to single place (#27331) 2021-04-15 12:25:04 +05:00
Diane Kaplan
3152c14192 fix: hide gated content message for library content questions (learning MFE only) (#27277) 2021-04-14 14:11:21 -04:00
stvn
2fa36fb0cf refactor: Move StaffFactory helper to common/ 2021-04-14 07:26:39 -07:00
David Ormsbee
99c759f887 Revert "perf: avoid invoking codejail for problem response report" (#27310)
This reverts commit 35b2780658.
2021-04-12 17:17:31 -04:00
David Ormsbee
35b2780658 perf: avoid invoking codejail for problem response report
We don't need to execute instuctor code for the problem response
report because we're grabbing existing student state and scores.
Running codejail is expensive, slow, and risks report failures if
there is CPU intensive instructor code that is run at times when
the servers are already heavily loaded (and things start timing
out). This came up in TNL-8183 (and many others).
2021-04-07 11:11:07 -04:00
Piotr Surowiec
bc1e9afe4b feat: allow overriding unit icons (#21433)
This:
1. Introduces a new override using the `pluggable_override` decorator.
It is now possible to specify a custom way of getting XBlock's icon
by defining `GET_UNIT_ICON_IMPL` in settings.
2. Introduces a way to add custom `XBLOCK_MIXINS` by defining
`XBLOCK_EXTRA_MIXINS` in settings. This allows, e.g. to add
new fields to XBlocks.
2021-04-07 09:42:12 -04:00
Ahtisham Shahid
f3a62b5f89 Error message for proctor exam show to user (#27238)
* Error message for proctor exam visible to user

* Created exception class for Invalid Proctor settings
2021-04-07 10:46:19 +05:00
stvn
716b84d9df Merge PR #27202 fix/capa/empty-option-text
* Commits:
  fix: Allow capa_problem optioninput option with empty text
  refactor: Refactor capa_problem optioninput option text handling
2021-04-05 13:27:22 -07:00
Awais Jibran
bc8e21d340 Address comments in the doc (#27240) 2021-04-05 17:06:36 +05:00
stvn
21dce731f9 fix: Allow capa_problem optioninput option with empty text
This fixes TNL-7973 [1].

Background
----------

> An alert was sent out because a malformed capa problem caused block
> transformers to fail to run.

> This specific error/alert was triggered when an optionresponse problem
> lacked text. The authoring-based fix is to edit the offending
> option-response problem to remove the empty option.

> Expected behavior: We should be able to keep the error local to the
> ProblemBlock and not blow up the whole course publish block
> transformer collection process.

> This is a really easy error for authors to make, and the consequences
> to them (one problem doesn’t work) are disproportionate to the
> consequences [...] (alerting triggered).

- [1] https://openedx.atlassian.net/browse/TNL-7973
2021-04-02 14:36:20 -07:00
David Ormsbee
d2389fb7fb fix: Don't break export when transcript is Latin-1 encoded.
Video SJSON transcripts are supposed to be UTF-8 encoded, but SJSON
is an ad hoc thing we made up to make it easier to build the
transcripts viewer in the VideoBlock, and it's not well specified.
Prior to this commit, if you had an SJSON file with Latin-1 encoded
text outside the standard ASCII range (e.g. û), then we'd error out
while trying to export it.

This was blocking an effort to export some Old Mongo courses (TNL-8007).
2021-04-02 13:33:16 -04:00
AsadAzam
c4da6c1fe4 Display import errors to user (#27147)
* Display import errors to user

* Refactored

* Refactored

* Refactored

* Fixed quality

* Fixed quality

* Refactored code

* Fixed message

* Refactored code
2021-04-02 18:53:39 +05:00
Azan Bin Zahid
2136cde713 Merge pull request #226 from edx/im-security-13
Incident Management Security Fix 13
2021-04-02 12:30:04 +05:00
stvn
9afa58f963 refactor: Refactor capa_problem optioninput option text handling
to make it easier to add/remove parsing/processing logic
(in pending commits).
2021-03-31 09:58:29 -07:00
Awais Jibran
529a805c0c Fixing dates serialization in course import (#27137) 2021-03-29 13:43:01 +05:00
Azan Bin Zahid
1e65f7c23b PROD-2303 2021-03-24 18:13:36 +05:00