diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-24 18:08:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-24 18:08:28 +0300 |
commit | 8e1bb8745bafe36f273ce4a095c3576c38ceb8b4 (patch) | |
tree | ec27d8dc078480009afe783f7bea87d3927f28f1 /app/assets/javascripts/issues | |
parent | 4b4c254b2cfaca26c2c8e2bda70d45c13e3a6f97 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/issues')
-rw-r--r-- | app/assets/javascripts/issues/create_merge_request_dropdown.js | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/app/assets/javascripts/issues/create_merge_request_dropdown.js b/app/assets/javascripts/issues/create_merge_request_dropdown.js index 8294c018117..c5f31081625 100644 --- a/app/assets/javascripts/issues/create_merge_request_dropdown.js +++ b/app/assets/javascripts/issues/create_merge_request_dropdown.js @@ -11,6 +11,7 @@ import createFlash from '~/flash'; import axios from '~/lib/utils/axios_utils'; import { __, sprintf } from '~/locale'; import { mergeUrlParams } from '~/lib/utils/url_utility'; +import api from '~/api'; // Todo: Remove this when fixing issue in input_setter plugin const InputSetter = { ...ISetter }; @@ -149,7 +150,7 @@ export default class CreateMergeRequestDropdown { }); } - createBranch() { + createBranch(navigateToBranch = true) { this.isCreatingBranch = true; return axios @@ -158,7 +159,10 @@ export default class CreateMergeRequestDropdown { }) .then(({ data }) => { this.branchCreated = true; - window.location.href = data.url; + + if (navigateToBranch) { + window.location.href = data.url; + } }) .catch(() => createFlash({ @@ -170,23 +174,25 @@ export default class CreateMergeRequestDropdown { createMergeRequest() { return new Promise(() => { this.isCreatingMergeRequest = true; - return this.createBranch().then(() => { - let path = canCreateConfidentialMergeRequest() - ? this.createMrPath.replace( - this.projectPath, - confidentialMergeRequestState.selectedProject.pathWithNamespace, - ) - : this.createMrPath; - path = mergeUrlParams( - { - 'merge_request[target_branch]': this.refInput.value, - 'merge_request[source_branch]': this.branchInput.value, - }, - path, - ); - - window.location.href = path; - }); + return this.createBranch(false) + .then(() => api.trackRedisHllUserEvent('i_code_review_user_create_mr_from_issue')) + .then(() => { + let path = canCreateConfidentialMergeRequest() + ? this.createMrPath.replace( + this.projectPath, + confidentialMergeRequestState.selectedProject.pathWithNamespace, + ) + : this.createMrPath; + path = mergeUrlParams( + { + 'merge_request[target_branch]': this.refInput.value, + 'merge_request[source_branch]': this.branchInput.value, + }, + path, + ); + + window.location.href = path; + }); }); } |