Skip to content

[BB-6692] Prepare opencraft-release/nutmeg.2 branch for edx-platform - #490

Merged
0x29a merged 15 commits into
opencraft-release/nutmeg.2from
0x29a/bb6692/cherrypick-code-drift-to-nutmeg
Oct 6, 2022
Merged

[BB-6692] Prepare opencraft-release/nutmeg.2 branch for edx-platform#490
0x29a merged 15 commits into
opencraft-release/nutmeg.2from
0x29a/bb6692/cherrypick-code-drift-to-nutmeg

Conversation

@0x29a

@0x29a 0x29a commented Sep 20, 2022

Copy link
Copy Markdown

Description

This PR prepares the shared opencraft-release/nutmeg.2 branch for our fork of https://github.com/openedx/edx-platform.

Code-drift commits

Commit Related Task Upstream PR Included in open-release/nutmeg.2 Should be cherry-picked? Notes
ab7aba5 openedx#30259 openedx#30259
c5eec53 openedx#30027 openedx@7b5e9a5
43a0277 openedx#30284 openedx#30285
2bbf06e openedx#29890 openedx@88a5e41
df63cbb openedx#28219 openedx#28219
36b0a19 BB-4951 openedx#29326
18a7473 openedx#30544 openedx#30544
5eef411 BB-1389 openedx#20948 (closed) Squashed and cherry-picked from the original PR. Conflicts.
d393d6e FAL-2248 Fix is in Django 4, so this will be needed until Open EdX moved to Django 4.
949dbcd BB-5849 openedx#28518 openedx#28518
b0fc6de BB-5271 openedx#29674
5a53418 openedx#30361
e48fa58 BB-4381 openedx#28861 openedx#28861
794ccc8 SE-5299 openedx#29851 openedx#29851
20c416a BB-6041 openedx#30130
aa89996 Linting issues have been fixed upstream.
6977077 BB-4060 openedx#27466 openedx#27466
0ae9706 BB-4503 openedx#28268 openedx#28268
7344a4e BB-4994 openedx#29106
a5fae17 BB-5258 openedx#29728
d0e6c30 BB-5815 openedx#27857 Had to return LOG_PREFIX and import WaffleFlag.
09c0b96 BB-5819 openedx#29850
4ed429f BB-5429 openedx#30314
695f67b openedx#29520 openedx#29520
340f3a7 openedx#29676 openedx#29676
f2ba308 openedx#29979 openedx#29979
85d99bb
f82574b BB-6077 openedx#30244 openedx#30572
86d0418 SE-4860 openedx#29046 openedx#29046
1e65dea SE-4860 openedx#29046 openedx#29046
a440f5c openedx#30309 This has been reverted here.
8f6f797 BB-4823 openedx#29180 openedx#29180
ca32428 BB-6438 openedx#30693
44b956b BB-6533 openedx#30832
dd75da6 BB-5885 openedx#30108

Supporting information

Suggested sandbox configuration

# needed for the testing of https://github.com/open-craft/configuration/pull/154
newrelic_query_key: ""
newrelic_query_api_url: ""
uptime_report_s3_bucket: ""

# needed for the testing of https://github.com/open-craft/configuration/pull/159
# needed for the testing of https://github.com/openedx/edx-platform/pull/29326
# needed for the testing of https://github.com/openedx/edx-platform/pull/30832
EDXAPP_REINDEX_ALL_COURSES: true
EDXAPP_FEATURES_EXTRA:
  ENABLE_COURSEWARE_INDEX: true
  ENABLE_COURSEWARE_SEARCH: true
  ENABLE_DASHBOARD_SEARCH: true
  ENABLE_LIBRARY_INDEX: true
  DISABLE_UNENROLLMENT: true
  ENABLE_LEGACY_MD5_HASH_FOR_ANONYMOUS_USER_ID: true
  

# needed for the testing of https://github.com/openedx/configuration/pull/6773
EDXAPP_ENABLE_CLOUDWATCH: true

# needed for the testing of https://github.com/openedx/edx-platform/pull/30314
EDXAPP_CMS_ENV_EXTRA:
  SCHEDULE_DETAIL_FORMAT: 'DD/MM/YYYY'

# needed for the testing of https://github.com/openedx/edx-platform/pull/30693
EDXAPP_AUTH_PASSWORD_VALIDATORS:
  - NAME: 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
  - NAME: 'common.djangoapps.util.password_policy_validators.MinimumLengthValidator'
    OPTIONS:
      min_length: 10
  - NAME: 'common.djangoapps.util.password_policy_validators.MaximumLengthValidator'
    OPTIONS:
      max_length: 75
EDXAPP_LMS_ENV_EXTRA:
  PASSWORD_POLICY_COMPLIANCE_ROLLOUT_CONFIG:
    ENFORCE_COMPLIANCE_ON_LOGIN: true
    GENERAL_USER_COMPLIANCE_DEADLINE: '2022-08-01 00:00:00+00:00'

# needed for the testing of https://github.com/openedx/edx-platform/pull/30108
EDXAPP_CUSTOM_RESOURCE_TEMPLATES_DIRECTORY: /edx/var/edx-themes/edx-themes/resource-templates

Testing instructions

36b0a19

You shouldn't be able to un-enroll from the course.

5eef411

  1. Ensure the logged in user has submitted a few problems.
  2. Browse https://nutmeg-upgrade.opencraft.hosting/api/enrollment/v1/submission_history
  3. Make sure a JSON object showing the user submissions is displayed

d393d6e

Doesn't need to be tested separately.

b0fc6de

  1. Login to LMS in the sandbox as staff user
  2. Go to account settings, by clicking on arrow beside username in upper-right corner and selecting 'Account' from the drop-down menu
  3. Set the Time Zone as prefered
  4. Go to Studio and open a course
  5. Go to Settings > Schedule & Details
  6. Under Course Schedule, check Course date and times.
  7. The times should be in the prefered timezone
  8. Check the time is correcly offset from UTC time

5a53418

Doesn't need to be tested separately.

20c416a

  1. Setup a minimum password length validator, enable compliance on login and set a deadline.
  2. Register or login with a password that doesn't meet the password requirement.
  3. Verify the warning message shown is formatted correctly.

7344a4e

  1. Create a Blank Advanced Problem XBlock with the following content (it will not render correctly, but don't worry about it):
     <problem>
       You should not
       <solution>Test solution.</solution>
       <solution explanation-id="solution0">Test solution with attribute.</solution>
       <solutionset>
         Test solutionset.
       <solution explanation-id="solution1">Test solution within solutionset.</solution>
       </solutionset>
       <targetedfeedback>Test feedback.</targetedfeedback>
       <targetedfeedback explanation-id="feedback0">Test feedback with attribute.</targetedfeedback>
       <targetedfeedbackset>
         Test FeedbackSet.
         <targetedfeedback explanation-id="feedback1">Test feedback within feedbackset.</targetedfeedback>
       </targetedfeedbackset>
       <answer>Test answer.</answer>
       <answer type="loncapa/python">Test answer with attribute.</answer>
       <script>Test script.</script>
       <script type="loncapa/python">Test script with attribute.</script>
       <style>Test style.</style>
       <style media="all and (max-width: 1920px)">Test style with attribute.</style>
       <choicehint>Test choicehint.</choicehint>
       <hint>Test hint.</hint>
       <hintpart>Test hintpart.</hintpart>
       see anything else.
     </problem>
    
  2. Click the "Reindex" button on the Course Outline page in Studio (just in case).
  3. Go to your dashboard in LMS and search for "anything else". You should see the following result: "You should not see anything else.".

a5fae17

  1. In Studio, create a Randomized Content Block and set the Show Reset Button option to True.
  2. View the live version of the new block and click on the Reset Problems button on the bottom left part of the Randomized Content Block.
  3. Verify that the contents of the block are reloaded, answers are reset and the questions are changed.

d0e6c30

  1. Go to the setting > Course team of the Demonstration Course
  2. Add verified@example.com as the staff for the course
  3. Login from the verified@example.com on the studio page
  4. verified@example.com should not be able to see the delete button on the course outline page.

09c0b96

  1. Open Studio.
  2. Enable certificates on the a course.
  3. On clicking "Set up your certificate", you should see the additional field "Course Description".
  4. Add in some text for course description and preview certificate.
  5. Verify that the custom course description is shown on the certificate.

4ed429f

  1. Look at the studio --> course(Demo Course) --> settings --> Schedule and Details
  2. Go under the Course Schedule section and you will see the date format is DD/MM/YYYY

85d99bb

Tests are passing, so this doesn't need to be tested.

ca32428

  1. Login as a user with password < 10 characters and verify that the warning message is seen on the dashboard.

44b956b

TODO: find a way to test that the hash is MD5.

dd75da6

  1. Update the setting settings.CUSTOM_RESOURCE_TEMPLATES_DIRECTORY to a valid path.
  2. In that directory create an html directory.
  3. Copy a template from common/lib/xmodule/xmodule/templates/html to the above directory with a different filename.
  4. In the Studio, edit a Unit. Under the Text component you should see your new template list (on the Sandbox I've added many).

@0x29a 0x29a self-assigned this Sep 20, 2022
@0x29a
0x29a force-pushed the 0x29a/bb6692/cherrypick-code-drift-to-nutmeg branch 6 times, most recently from a1455ec to 40ad3e1 Compare September 22, 2022 14:59
@0x29a

0x29a commented Oct 3, 2022

Copy link
Copy Markdown
Author

Testing results

  1. 36b0a19: verified that "Unenroll" button isn't visible.
  2. 5eef411: completed one unit, verified that the submission history is present on https://nutmeg-upgrade.opencraft.hosting/api/enrollment/v1/submission_history
  3. d393d6e: covered by our manual instance testing checklist.
  4. b0fc6de: correct timezone is showing up at Course Schedule.
  5. 5a53418: covered by our manual instance testing checklist.
  6. 20c416a: changed my password to edx, was able to see Required Action: Please update your password at the dashboard after re-login, and didn't see any raw HTML.
  7. 7344a4e: was able to see You should not see anything else in the search.
  8. a5fae17: reset button worked as expected, and I was getting problems from the library randomly. Note: the original test instructions don't cover block setup (i.e. creating a library).
  9. d0e6c30: delete button disappeared after enabling the studio.prevent_staff_structure_deletion waffle flag. Note: the original test instructions don't contain waffle flag adding step.
  10. 09c0b96: specified Test Description as description, was able to see Test Description on the certificate preview. Note: to create a certificate, I had to add honor course mode here.
  11. 4ed429f: verified that the dates are in the DD/MM/YYYY format, which differs from the default (MM/DD/YYYY).
  12. 85d99bb: tests are passing.
  13. ca32428: changed my password to edx, was able to see Required Action: Please update your password at the dashboard after re-login. The message also contains Nov 01, 2022 deadline, which is exactly what I specified in the sandbox config.
  14. 44b956b:
    1. /edx/bin/edxapp-shell-lms
    2. from django.contrib.auth import get_user_model
    3. get_user_model().objects.get(username='demid_test').anonymoususerid_set.first().anonymous_user_id
    4. Above yielded e20f4ad3c680a687ca5aee07fcdf172f, which is MD5.
  15. dd75da6:
    1. SSH'd into the sandbox.
    2. cd /edx/var/edx-themes/edx-themes/
    3. sudo mkdir -p resource-templates/html
    4. sudo cp /edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/templates/html/latex_html.yaml resource-templates/html/hello.yaml
    5. sudo vim resource-templates/html/hello.yaml (made display unique)
    6. sudo chown -R edx-themes:www-data resource-templates
    7. /edx/bin/supervisorctl restart cms
    8. Verified that Add New Component -> Text dropdown contains my custom template.

@0x29a 0x29a changed the title [WIP][BB-6692] Prepare opencraft-release/nutmeg.2 branch for edx-platform [BB-6692] Prepare opencraft-release/nutmeg.2 branch for edx-platform Oct 3, 2022
@0x29a
0x29a requested a review from Agrendalath October 3, 2022 13:34

@Agrendalath Agrendalath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0x29a, whoa, thank you for the amazing description of this PR and the detailed testing report! I've left few small comments, but these are not blockers.

👍

  • I tested this: checked the features locally
  • I read through the code
  • I checked for accessibility issues: n/a
  • Includes documentation: n/a
  • I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository: n/a

Comment thread openedx/core/djangoapps/content/block_structure/store.py Outdated
Comment thread lms/envs/test.py Outdated
Comment thread lms/djangoapps/certificates/views/webview.py Outdated
@0x29a
0x29a force-pushed the 0x29a/bb6692/cherrypick-code-drift-to-nutmeg branch 4 times, most recently from 88cacde to 220780f Compare October 5, 2022 16:27
0x29a and others added 15 commits October 5, 2022 18:39
…dx#29326)

Implements a feature flag DISABLE_UNENROLLMENT that is used to disable students un-enrollment for all courses. The Unenrollment option should be disabled when this feature is set to True.

ref: BB-4951

Co-authored-by: tinumide <tinuade@opencraft.com>
Co-authored-by: Tim McCormack <tmccormack@edx.org>
(cherry picked from commit da4a6d6)
… endpoint

(squashed and cherry picked from openedx#20948)

NOTE 1: during a next release preparation, don't cherry-pick the
original commit, as they are heavily outdated. Cherry-pick this one, as
it has linting and compatibility fixes.

NOTE 2: `max_mongo_calls` in `EnrollmentTestMixin` was bumped from 8 to
12.
(cherry picked from commit d393d6e AND
fixed linting issues)
Most tags that could contain solutions or hints were already being removed,
but the regex did not include the case when they contained attributes.

(cherry picked from commit 0ef57eb)
This makes the reset button to refresh the contents of a Randomized
Content Block (RCB) without reloading the full page by fetching a new
set of problems in the "reset" response and replacing the DOM contents.

The reset button returns the student view as a string and the client
uses the HtmlUtils package to replace the contents and reinitializes the
XBlock.

This allows students to use the RCB as a flash card system.

Co-authored-by: tinumide <tinuade@opencraft.com>
(cherry picked from commit 2b39da6)
(cherry picked from commit c812a6c1d5c0961900507a6e7abe3d0f3b8a7570)
Adds the ability to edit the default course description
shown in certificates.

(cherry picked from commit a89baafe0575c94fac0cb4ce9db1d38ce0b71bc6)
This feature help to configure the date formatt in Schedule and Details
settings page.

Signed-off-by: Farhaan Bukhsh <farhaan@opencraft.com>
Co-authored-by: Joseph Curtin  <jbcurtin@opencraft.com>
(cherry picked from commit 64d44a8)
This fixes the issue of django messages being read before
redirecting to dashboard page, due to enterprise api being
called even if the feature is disabled.

(cherry picked from commit df489bd)
…to md5

The hashing algorithm has been changed in cd60646. However, there are Open edX
operators who maintain backward compatibility of anonymous user IDs after past
rotations of their Django secret key. For them, altering the hashing algorithm
was a breaking change that made their analytics inconsistent.

(cherry picked from commit 746e4fe)
This setting allows loading of Resource Templates from outside the
edx-platform codebase.

Operators will be able to add their own custom resource templates
without needing to fork the codebase.

(cherry picked from commit ed81774)
@0x29a
0x29a force-pushed the 0x29a/bb6692/cherrypick-code-drift-to-nutmeg branch from 220780f to 667ab7f Compare October 5, 2022 16:39
@0x29a
0x29a merged commit 9f2f922 into opencraft-release/nutmeg.2 Oct 6, 2022
@0x29a
0x29a deleted the 0x29a/bb6692/cherrypick-code-drift-to-nutmeg branch October 6, 2022 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants