Skip to content
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

Restrict approve and reject buttons on the Task Request detail page to super_user only #896

Conversation

AnujChhikara
Copy link
Contributor

@AnujChhikara AnujChhikara commented Oct 19, 2024

Date: 19 Oct 2024

Developer Name: Anuj Chhikara (anuj-chhikara-1)


Issue Ticket Number

Description

  • This PR ensures that only super users can see the Approve and Reject buttons on the task request page.
  • Modified the task request page to conditionally render the Approve and Reject buttons.
  • These buttons will now only appear if the logged-in user has the super_user role.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Updated Page

image

Buttons Working

brave_or3zX6Q2UM
brave_fh9SC9Nvll

Feature Flag

brave_5kVwwDtH5X

Test Coverage

Screenshot 1

Screenshot from 2024-10-20 10-55-42

Additional Notes

Copy link
Member

@iamitprakash iamitprakash left a comment

Choose a reason for hiding this comment

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

coverage seems low

task-requests/details/script.js Outdated Show resolved Hide resolved
task-requests/details/script.js Outdated Show resolved Hide resolved
task-requests/details/script.js Outdated Show resolved Hide resolved
task-requests/details/script.js Outdated Show resolved Hide resolved
@AnujChhikara AnujChhikara force-pushed the feature/restrict-approve-reject-buttons-to-super_users branch from 613f908 to 0609e65 Compare October 20, 2024 07:13
task-requests/details/index.html Outdated Show resolved Hide resolved
task-requests/details/script.js Outdated Show resolved Hide resolved
@AnujChhikara
Copy link
Contributor Author

coverage seems low

I have added the test coverage screenshot

mock-data/taskRequests/index.js Outdated Show resolved Hide resolved
task-requests/details/script.js Outdated Show resolved Hide resolved
Copy link
Member

@vinit717 vinit717 left a comment

Choose a reason for hiding this comment

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

Please write the test for the changes you made

Copy link
Member

@vinit717 vinit717 left a comment

Choose a reason for hiding this comment

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

Can you put these changes behind feature flag

@vinit717
Copy link
Member

Please update the video also showing both for feature flag and behind feature flag

@iamitprakash iamitprakash merged commit 44df325 into Real-Dev-Squad:develop Oct 29, 2024
4 checks passed
@vinit717 vinit717 mentioned this pull request Nov 1, 2024
VaibhavSingh8 pushed a commit that referenced this pull request Nov 4, 2024
…o super_user only (#896)

* Restrict approve and reject buttons on the Task Request detail page to super users only

* fixes naming convention, button render logic

* fix: reject button should not be part of the dom if condition not met

* changed the superUser data, make the task-request/script.js type module

* added tests how buttons should render for non-super user

* Update task-requestDetails.test.js

removed unused variable

* using data-testid for the tests

* importing the superuser data

* removing reject button from dom after successful task update

* put the changes behind the feature flag

---------

Co-authored-by: Achintya Chatterjee <[email protected]>
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.

Restrict 'Approve' and 'Reject' Buttons to Super Users in Task Request Page
5 participants