Skip to content

[BB-3710] Stop rendering Visibility button on libraries - #26885

Merged
ormsbee merged 1 commit into
openedx:masterfrom
open-craft:danielf/BB-3710
Mar 22, 2021
Merged

ormsbee merged 1 commit into
openedx:masterfrom
open-craft:danielf/BB-3710

Conversation

@spokerman12

@spokerman12 spokerman12 commented Mar 8, 2021 •

Copy link
Copy Markdown
Contributor

The original PR for this bugfix is open-craft#323

Description

We're fixing an error that appears when you click the "edit access" button on an XBlock in the library page.

Supporting information

Libraries in the "Add library" page shouldn't have the accessibility config icon. Access settings for libraries are changed at the top, on Settings > User Access.
When clicking the access-button (the cog) on a Library, an error appears.

This is know to happen on koa.master and open-release/juniper.3.

More on "Other information"

Testing instructions:

(Sandbox link)

  1. Create a new library
  2. Add a component
  3. Click the cogwheel button
  4. You should see this error (group configurations don't apply to Libraries because they're a particular type of XBlock that can be reused throughout its course org)
    image
  5. This fix removes the access button. You can pull this branch to your local devstack or use the sandbox link provided. the buttons shouldn't appear in the library page.

This happens due to the way XBlocks are rendered; as they get rendered initially, the previews are unaware of whether they're part of a library. We can confirm this by refreshing the page, this makes the button disappear.
image

This fix removes the cogwheel when the XBlock is part of a library. This doesn't affect the XBlocks imported to courses because those are rendered on a Randomized Content XBlock, which does have its access options.

image

Other information:

From library docs

You can give other Studio users access to your library. Depending on the level of access that you give them in the library, additional library users can view and use library content in courses, edit library content, or add and manage other library users. All users to whom you give library access must be registered with Studio and have an active account.

Ensure that the new library member has an active Studio account.
On the Studio home page, select the Libraries tab and locate the library to which you are adding this user.
From the Settings menu select User Access.
On the User Access page, select Add a New User.
Enter the new user’s email address, then select ADD USER.
The new user is added to the list of library members with the User level of access.

From randomized content XBlock docs

To create randomized assignments that make use of components from content libraries, you must have at least User level access to the libraries that you want to use. If you do not have access to a library, members of your course team who have Admin access to that library can grant you access.

The libraries that you create or have access to are listed on the Libraries tab on the Studio Home page. For details about content libraries, see Working with Content Libraries.

On the error image, we see that this has to do with groups. Groups are handled by course runs, so the Edit Access button has no place in a library (which is different from the Randomized XBlock that uses the library, which does support changing its access settings)

Deadline:

None

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Mar 8, 2021
@openedx-webhooks

openedx-webhooks commented Mar 8, 2021 •

Copy link
Copy Markdown

Thanks for the pull request, @spokerman12! I've created OSPR-5657 to keep track of it in JIRA, where we prioritize reviews. 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:

  • 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.

@spokerman12 spokerman12 changed the title [WIP][BB-3710] Stop rendering Visibility button on libraries [BB-3710] Stop rendering Visibility button on libraries Mar 8, 2021
@spokerman12 spokerman12 changed the title [BB-3710] Stop rendering Visibility button on libraries [WIP] [BB-3710] Stop rendering Visibility button on libraries Mar 8, 2021
@spokerman12
spokerman12 marked this pull request as ready for review March 8, 2021 01:30
@spokerman12
spokerman12 changed the base branch from open-release/koa.master to master March 8, 2021 13:39
@spokerman12 spokerman12 changed the title [WIP] [BB-3710] Stop rendering Visibility button on libraries [BB-3710] Stop rendering Visibility button on libraries Mar 8, 2021
@openedx-webhooks openedx-webhooks added needs triage and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Mar 8, 2021
@natabene

natabene commented Mar 8, 2021

Copy link
Copy Markdown
Contributor

@spokerman12 Thank you for your contribution. Is this ready for our review?

@shimulch shimulch left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM 👍

  • I tested this on my local devstack. Checked if the Cog icon shows while adding a new xblock.
  • I read through the code.

@spokerman12

Copy link
Copy Markdown
Contributor Author

Hi, @natabene! Yes, this is ready for review.

@bradenmacdonald

Copy link
Copy Markdown
Contributor

@natabene I'd be happy to review this one if you'd like?

@natabene

Copy link
Copy Markdown
Contributor

@bradenmacdonald Thanks for offering. @sarina Are you ok with Braden reviewing this as a core committer?

@sarina

sarina commented Mar 14, 2021

Copy link
Copy Markdown
Contributor

I'm not 100% familiar with libraries but the description makes sense to me. I trust @bradenmacdonald more than myself on this one 😄

@natabene

Copy link
Copy Markdown
Contributor

@bradenmacdonald It is yours to review, thanks!

@bradenmacdonald bradenmacdonald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR makes sense, thanks. I just had a small request about how we fix it.

@bradenmacdonald bradenmacdonald Mar 15, 2021 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of adding this new context variable to the template, I would prefer that you correctly set can_edit_visibility, perhaps by changing the default on the line below:

'can_edit_visibility': context.get('can_edit_visibility', xblock.course_id.is_course),  # Default to true for courses, false for libraries

since it was pointed out on Jira that the move button has the same issue, we can fix it at the same time:

'can_move': context.get('can_move', xblock.course_id.is_course),

BTW, the reason for this is that if we're telling the template "can_edit_visibility: true or false", the template should not need additional logic to know if the user can really edit visibility or not; that's confusing and that type of logic belongs where the can_edit_visibility is set.

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.

I agree; the proposed solution was to avoid side effects based on context.

@edx-status-bot

Copy link
Copy Markdown

Your PR has finished running tests. There were no failures.

@ormsbee

ormsbee commented Mar 22, 2021

Copy link
Copy Markdown
Contributor

Merged. I copied some of the context from the PR into the commit message. I hope you don't mind.

Thank you!

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

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

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

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

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR may have caused e2e tests to fail on Stage. If you're a member of the edX org, please visit #e2e-troubleshooting on Slack to help diagnose the cause of these failures. Otherwise, it is the reviewer's responsibility. E2E tests have failed. https://gocd.tools.edx.org/go/tab/pipeline/history/deploy_to_stage

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@spokerman12
spokerman12 deleted the danielf/BB-3710 branch March 22, 2021 20:58
jansenk added a commit that referenced this pull request Mar 23, 2021
jansenk added a commit that referenced this pull request Mar 23, 2021
@ormsbee

ormsbee commented Mar 23, 2021

Copy link
Copy Markdown
Contributor

@spokerman12, @bradenmacdonald: This was reverted (see #27113) because it broke ORA display in Studio. I do not know the root cause.

jansenk added a commit that referenced this pull request Mar 23, 2021
jansenk added a commit that referenced this pull request Mar 24, 2021
* Revert "Revert "fix: Stop rendering Visibility and Move buttons on libraries (#26885)" (#27113)"

This reverts commit 23443c4.

* fix: change method of accessing course id
samuelallan72 pushed a commit to open-craft/openedx-platform that referenced this pull request Mar 26, 2021
* Revert "Revert "fix: Stop rendering Visibility and Move buttons on libraries (openedx#26885)" (openedx#27113)"

This reverts commit 23443c4.

* fix: change method of accessing course id

(cherry picked from commit 2379f1c)
shimulch pushed a commit to open-craft/openedx-platform that referenced this pull request Mar 26, 2021
* Revert "Revert "fix: Stop rendering Visibility and Move buttons on libraries (openedx#26885)" (openedx#27113)"

This reverts commit 23443c4.

* fix: change method of accessing course id

(cherry picked from commit 2379f1c)
shimulch pushed a commit to open-craft/openedx-platform that referenced this pull request Mar 26, 2021
* Revert "Revert "fix: Stop rendering Visibility and Move buttons on libraries (openedx#26885)" (openedx#27113)"

This reverts commit 23443c4.

* fix: change method of accessing course id

(cherry picked from commit 2379f1c)
0x29a pushed a commit to open-craft/openedx-platform that referenced this pull request Apr 20, 2021
* Revert "Revert "fix: Stop rendering Visibility and Move buttons on libraries (openedx#26885)" (openedx#27113)"

This reverts commit 23443c4.

* fix: change method of accessing course id

(cherry picked from commit 2379f1c)
Waleed-Mujahid pushed a commit to edly-io/edx-platform that referenced this pull request Oct 6, 2025
* Revert "Revert "fix: Stop rendering Visibility and Move buttons on libraries (openedx#26885)" (openedx#27113)"

This reverts commit 23443c4.

* fix: change method of accessing course id
Waleed-Mujahid added a commit to edly-io/edx-platform that referenced this pull request Oct 13, 2025
* Revert "Revert "fix: Stop rendering Visibility and Move buttons on libraries (openedx#26885)" (openedx#27113)"

This reverts commit 23443c4.

* fix: change method of accessing course id

Co-authored-by: Jansen Kantor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants