Do not show revoke button if revoke_path is absent
What does this MR do and why?
AccessTokenTableApp
component assumed that revoke_path
in the access
token is always present. However, the property revoke_path
is
optional.
When the revoke_path
is absent or falsy, it doesn't display the
revoke button action.
Screenshots or screen recordings
Before
After
How to set up and validate locally
- Create a personal access token:
- See the revoke button is present
- Apply patch:
diff --git a/app/assets/javascripts/access_tokens/index.js b/app/assets/javascripts/access_tokens/index.js
index f0c1b415157..c12b45bf2b1 100644
--- a/app/assets/javascripts/access_tokens/index.js
+++ b/app/assets/javascripts/access_tokens/index.js
@@ -43,7 +43,7 @@ export const initAccessTokenTableApp = () => {
provide: {
accessTokenType,
accessTokenTypePlural,
- initialActiveAccessTokens,
+ initialActiveAccessTokens: initialActiveAccessTokens.map(({ revokePath, ...rest }) => rest),
noActiveTokensMessage,
showRole,
},
- Reload the page and observe that the button is not present.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Eduardo Sanz García