Skip to content

fix/HIT-210_Internal-error-when-modifying-role-permissions #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: hit-oort
Choose a base branch
from

Conversation

GuilhermeGabriel
Copy link

@GuilhermeGabriel GuilhermeGabriel commented Jan 4, 2024

Description

The permission to allow editing of certain questions in a form creates an internal error.
It happened with a few questions (but not all) and only for updating, not the visibility.

Useful links

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Trying to add permission to allow update the field for fields specified on the ticket.

Screenshots

Before:

Screen.Recording.2024-01-04.at.09.18.48.mov

After:

Screen.Recording.2024-01-04.at.09.16.45.mov

Checklist:

( * == Mandatory )

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-backend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required )
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

More explanation

https://www.loom.com/share/05a716d61b9744faaf51fb304c21d1e5?sid=f87cf896-582a-4f76-93ae-8ceed801b145

@GuilhermeGabriel GuilhermeGabriel added the bug Something isn't working label Jan 4, 2024
@GuilhermeGabriel GuilhermeGabriel self-assigned this Jan 4, 2024
@GuilhermeGabriel GuilhermeGabriel marked this pull request as ready for review January 4, 2024 12:32
@@ -159,7 +159,7 @@ const checkFieldPermission = (
)
);
}
if (!get(field, 'permissions.canSee', []).find((p) => p.equals(role))) {
if (!get(field, 'permissions.canSee', []).find((p) => p === role)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (!get(field, 'permissions.canSee', []).find((p) => p === role)) {
if (!get(field, 'permissions.canSee', []).find((p) => p.toString() === role)) {

This guarantees that p is a string and not an oid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants