Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-04-13 15:34:41 +0300
committerFilipa Lacerda <filipa@gitlab.com>2018-04-20 11:52:16 +0300
commitabe4e6ddfa77bff82f4e39b5f6c79784c699f51d (patch)
treec753daf3693a9af8c82ac035124a4b9fb395030f /app
parent8e1a73f07baa54ec776936b09c904e963c0b94ce (diff)
Merge branch 'ide-mr-changes-alert-box' into 'master'
Remove confirm box when redirecting to new merge request form in IDE Closes #45326 See merge request gitlab-org/gitlab-ce!18362
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/ide/stores/modules/commit/actions.js70
1 files changed, 26 insertions, 44 deletions
diff --git a/app/assets/javascripts/ide/stores/modules/commit/actions.js b/app/assets/javascripts/ide/stores/modules/commit/actions.js
index f536ce6344b..367c45f7e2d 100644
--- a/app/assets/javascripts/ide/stores/modules/commit/actions.js
+++ b/app/assets/javascripts/ide/stores/modules/commit/actions.js
@@ -37,9 +37,9 @@ export const setLastCommitMessage = ({ rootState, commit }, data) => {
const commitMsg = sprintf(
__('Your changes have been committed. Commit %{commitId} %{commitStats}'),
{
- commitId: `<a href="${currentProject.web_url}/commit/${
+ commitId: `<a href="${currentProject.web_url}/commit/${data.short_id}" class="commit-sha">${
data.short_id
- }" class="commit-sha">${data.short_id}</a>`,
+ }</a>`,
commitStats,
},
false,
@@ -54,9 +54,7 @@ export const checkCommitStatus = ({ rootState }) =>
.then(({ data }) => {
const { id } = data.commit;
const selectedBranch =
- rootState.projects[rootState.currentProjectId].branches[
- rootState.currentBranchId
- ];
+ rootState.projects[rootState.currentProjectId].branches[rootState.currentBranchId];
if (selectedBranch.workingReference !== id) {
return true;
@@ -135,32 +133,15 @@ export const updateFilesAfterCommit = (
if (state.commitAction === consts.COMMIT_TO_NEW_BRANCH) {
router.push(
- `/project/${rootState.currentProjectId}/blob/${branch}/${
- rootGetters.activeFile.path
- }`,
+ `/project/${rootState.currentProjectId}/blob/${branch}/${rootGetters.activeFile.path}`,
);
}
-
- dispatch('updateCommitAction', consts.COMMIT_TO_CURRENT_BRANCH);
};
-export const commitChanges = ({
- commit,
- state,
- getters,
- dispatch,
- rootState,
-}) => {
+export const commitChanges = ({ commit, state, getters, dispatch, rootState }) => {
const newBranch = state.commitAction !== consts.COMMIT_TO_CURRENT_BRANCH;
- const payload = createCommitPayload(
- getters.branchName,
- newBranch,
- state,
- rootState,
- );
- const getCommitStatus = newBranch
- ? Promise.resolve(false)
- : dispatch('checkCommitStatus');
+ const payload = createCommitPayload(getters.branchName, newBranch, state, rootState);
+ const getCommitStatus = newBranch ? Promise.resolve(false) : dispatch('checkCommitStatus');
commit(types.UPDATE_LOADING, true);
@@ -182,28 +163,29 @@ export const commitChanges = ({
if (!data.short_id) {
flash(data.message, 'alert', document, null, false, true);
- return;
+ return null;
}
dispatch('setLastCommitMessage', data);
dispatch('updateCommitMessage', '');
-
- if (state.commitAction === consts.COMMIT_TO_NEW_BRANCH_MR) {
- dispatch(
- 'redirectToUrl',
- createNewMergeRequestUrl(
- rootState.projects[rootState.currentProjectId].web_url,
- getters.branchName,
- rootState.currentBranchId,
- ),
- { root: true },
- );
- } else {
- dispatch('updateFilesAfterCommit', {
- data,
- branch: getters.branchName,
- });
- }
+ return dispatch('updateFilesAfterCommit', {
+ data,
+ branch: getters.branchName,
+ })
+ .then(() => {
+ if (state.commitAction === consts.COMMIT_TO_NEW_BRANCH_MR) {
+ dispatch(
+ 'redirectToUrl',
+ createNewMergeRequestUrl(
+ rootState.projects[rootState.currentProjectId].web_url,
+ getters.branchName,
+ rootState.currentBranchId,
+ ),
+ { root: true },
+ );
+ }
+ })
+ .then(() => dispatch('updateCommitAction', consts.COMMIT_TO_CURRENT_BRANCH));
})
.catch(err => {
let errMsg = __('Error committing changes. Please try again.');