Jira Connect create branch page: Alert when lacking permissions
What does this MR do and why?
On the Jira Connect New Branch page, we add an alert when a user selects a project that don't have the push_code permission for.
Related to #337274 (closed)
Screenshots or screen recordings
How to set up and validate locally
-
On a given GitLab project, set your user permission such you don't have
push_codepermission for the project.Tip
👉 apply this diff to "force" set the pushCode permission to false for theGitlab Testproject.
diff --git a/app/assets/javascripts/jira_connect/branches/components/new_branch_form.vue b/app/assets/javascripts/jira_connect/branches/components/new_branch_form.vue
index 94cf4dd2748..2ab7e09c2f8 100644
--- a/app/assets/javascripts/jira_connect/branches/components/new_branch_form.vue
+++ b/app/assets/javascripts/jira_connect/branches/components/new_branch_form.vue
@@ -93,6 +93,9 @@ export default {
this.selectedProject = project;
this.selectedSourceBranchName = null; // reset branch selection
this.hasPermission = this.selectedProject.userPermissions.pushCode;
+ if (this.selectedProject.name === 'Gitlab Test') {
+ this.hasPermission = false;
+ }
if (!this.hasPermission) {
this.setPermissionAlert();
- Navigate to http://gdk.test:3000/-/jira_connect/branches/new
- Select the project for which you don't have permission (if using the patch provided, select the
Gitlab testproject). - Observe. An alert should appear.
- Select a different project. You should have
push_codepermission for this project. - Observe, the form should expand and no alert should appear.
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 Tom Quirk