Skip to content

feat: expose hide_from_toc field in course blocks - #33955

Merged
mariajgrimaldi merged 2 commits into
openedx:masterfrom
eduNEXT:bav/return-hide-from-toc-field
Feb 15, 2024
Merged

feat: expose hide_from_toc field in course blocks#33955
mariajgrimaldi merged 2 commits into
openedx:masterfrom
eduNEXT:bav/return-hide-from-toc-field

Conversation

@BryanttV

@BryanttV BryanttV commented Dec 19, 2023

Copy link
Copy Markdown
Contributor

Description

This PR exposes the hide_from_toc field for course blocks (sections, sequences...) so it's visible as part of the course metadata.

This change is made to show instructors a message in the course outline for the hidden sections and their children. However, it can be used by any other client to obtain content visibility information.

Supporting information

These changes are part of the effort made to implement Feature Enhancement Proposal: Hide Sections from Course Outline

What Changed?

/api/course_home/outline/{course-id}

This endpoint was updated to return the hide_from_toc field in the blocks of the course. The following is an example of the response:

{
   ...
   "course_blocks": {
      "blocks": {
         "block-v1:eduNEXT+HFT+Demo+type@course+block@course": {
            "children": [
               "block-v1:eduNEXT+HFT+Demo+type@chapter+block@1d110f659c154377b6f764189cc7fa35"
            ],
            "complete": true,
            "description": null,
            "display_name": "Hide From TOC Course",
            "due": null,
            "effort_activities": 0,
            "effort_time": 1,
            "icon": null,
            "id": "block-v1:eduNEXT+HFT+Demo+type@course+block@course",
            "lms_web_url": "http://local.overhang.io:8000/courses/course-v1:eduNEXT+HFT+Demo/jump_to/block-v1:eduNEXT+HFT+Demo+type@course+block@course",
            "resume_block": true,
            "type": "course",
            "has_scheduled_content": null,
            "hide_from_toc": false
         },
         "block-v1:eduNEXT+HFT+Demo+type@chapter+block@1d110f659c154377b6f764189cc7fa35": {
            "children": [
               "block-v1:eduNEXT+HFT+Demo+type@sequential+block@4fbfd9bb42284431af028c812cc6bbd5"
            ],
            "complete": true,
            "description": null,
            "display_name": "Section",
            "due": null,
            "effort_activities": 0,
            "effort_time": 1,
            "icon": null,
            "id": "block-v1:eduNEXT+HFT+Demo+type@chapter+block@1d110f659c154377b6f764189cc7fa35",
            "lms_web_url": "http://local.overhang.io:8000/courses/course-v1:eduNEXT+HFT+Demo/jump_to/block-v1:eduNEXT+HFT+Demo+type@chapter+block@1d110f659c154377b6f764189cc7fa35",
            "resume_block": true,
            "type":" chapter",
            "has_scheduled_content": null,
            "hide_from_toc": false
         },
         "block-v1:eduNEXT+HFT+Demo+type@sequential+block@4fbfd9bb42284431af028c812cc6bbd5": {
            "children": [
               
            ],
            "complete": true,
            "description": null,
            "display_name": "Subsection",
            "due": null,
            "effort_activities": 0,
            "effort_time": 1,
            "icon": null,
            "id": "block-v1:eduNEXT+HFT+Demo+type@sequential+block@4fbfd9bb42284431af028c812cc6bbd5",
            "lms_web_url": "http://local.overhang.io:8000/courses/course-v1:eduNEXT+HFT+Demo/jump_to/block-v1:eduNEXT+HFT+Demo+type@sequential+block@4fbfd9bb42284431af028c812cc6bbd5",
            "resume_block": true,
            "type": "sequential",
            "has_scheduled_content": null,
            "hide_from_toc": false
         }
      }
   }
   ...
}

Testing instructions

  1. Move into this branch

  2. Create your course with sections and subsections.

  3. Using CURL you can test the endpoint. Replace the value of the variables with your values as appropriate:

    curl --location '{lms-domain}/api/course_home/outline/{course-id}' \
    --header 'Authorization: Bearer {access-token}'

    Another option is to go to the course outline in the URL: {mfe-domain}/learning/course/{course-id}/home. Right-click > Inspect > Network. Select the endpoint request and review the response.

    image

  4. In all course blocks the hide_from_toc field should be set to false

Deadline

This effort is part of the Spanish consortium project, so it'd be ideal to merge this before the end of the project.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Dec 19, 2023
@openedx-webhooks

openedx-webhooks commented Dec 19, 2023

Copy link
Copy Markdown

Thanks for the pull request, @BryanttV! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@BryanttV BryanttV changed the title feat: return hide_from_toc field in course blocks feat: expose hide_from_toc field in course blocks Dec 19, 2023
@BryanttV
BryanttV force-pushed the bav/return-hide-from-toc-field branch from 60f9b79 to 3a0ef1d Compare December 19, 2023 18:48
@BryanttV
BryanttV force-pushed the bav/return-hide-from-toc-field branch 2 times, most recently from 3a0ef1d to a3c8e7d Compare December 29, 2023 03:47
@BryanttV
BryanttV force-pushed the bav/return-hide-from-toc-field branch from a3c8e7d to 247909b Compare January 11, 2024 14:32
@BryanttV
BryanttV marked this pull request as ready for review January 11, 2024 14:33

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.

why is this change necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If the field is not added to the requested_fields list, the field is returned null

@BryanttV
BryanttV force-pushed the bav/return-hide-from-toc-field branch from 247909b to 7fb8abb Compare February 12, 2024 16:13

@mariajgrimaldi mariajgrimaldi 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.

I tested this in my local environment, and it's working as you described in the cover letter! Thank you.

@openedx-webhooks

Copy link
Copy Markdown

@BryanttV 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@itsjeyd itsjeyd added the product review PR requires product review before merging label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U product review PR requires product review before merging

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants