Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4e56af3b
Commit
4e56af3b
authored
Apr 13, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove confirm box when redirecting to new merge request form in IDE
Closes #45326
parent
4758db5a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
74 deletions
+67
-74
app/assets/javascripts/ide/stores/modules/commit/actions.js
app/assets/javascripts/ide/stores/modules/commit/actions.js
+26
-44
changelogs/unreleased/ide-mr-changes-alert-box.yml
changelogs/unreleased/ide-mr-changes-alert-box.yml
+5
-0
spec/javascripts/ide/stores/modules/commit/actions_spec.js
spec/javascripts/ide/stores/modules/commit/actions_spec.js
+36
-30
No files found.
app/assets/javascripts/ide/stores/modules/commit/actions.js
View file @
4e56af3b
...
@@ -37,9 +37,9 @@ export const setLastCommitMessage = ({ rootState, commit }, data) => {
...
@@ -37,9 +37,9 @@ export const setLastCommitMessage = ({ rootState, commit }, data) => {
const
commitMsg
=
sprintf
(
const
commitMsg
=
sprintf
(
__
(
'
Your changes have been committed. Commit %{commitId} %{commitStats}
'
),
__
(
'
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
data
.
short_id
}
" class="commit-sha">
${
data
.
short_id
}
</a>`
,
}
</a>`
,
commitStats
,
commitStats
,
},
},
false
,
false
,
...
@@ -54,9 +54,7 @@ export const checkCommitStatus = ({ rootState }) =>
...
@@ -54,9 +54,7 @@ export const checkCommitStatus = ({ rootState }) =>
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
const
{
id
}
=
data
.
commit
;
const
{
id
}
=
data
.
commit
;
const
selectedBranch
=
const
selectedBranch
=
rootState
.
projects
[
rootState
.
currentProjectId
].
branches
[
rootState
.
projects
[
rootState
.
currentProjectId
].
branches
[
rootState
.
currentBranchId
];
rootState
.
currentBranchId
];
if
(
selectedBranch
.
workingReference
!==
id
)
{
if
(
selectedBranch
.
workingReference
!==
id
)
{
return
true
;
return
true
;
...
@@ -135,32 +133,15 @@ export const updateFilesAfterCommit = (
...
@@ -135,32 +133,15 @@ export const updateFilesAfterCommit = (
if
(
state
.
commitAction
===
consts
.
COMMIT_TO_NEW_BRANCH
)
{
if
(
state
.
commitAction
===
consts
.
COMMIT_TO_NEW_BRANCH
)
{
router
.
push
(
router
.
push
(
`/project/
${
rootState
.
currentProjectId
}
/blob/
${
branch
}
/
${
`/project/
${
rootState
.
currentProjectId
}
/blob/
${
branch
}
/
${
rootGetters
.
activeFile
.
path
}
`
,
rootGetters
.
activeFile
.
path
}
`
,
);
);
}
}
dispatch
(
'
updateCommitAction
'
,
consts
.
COMMIT_TO_CURRENT_BRANCH
);
};
};
export
const
commitChanges
=
({
export
const
commitChanges
=
({
commit
,
state
,
getters
,
dispatch
,
rootState
})
=>
{
commit
,
state
,
getters
,
dispatch
,
rootState
,
})
=>
{
const
newBranch
=
state
.
commitAction
!==
consts
.
COMMIT_TO_CURRENT_BRANCH
;
const
newBranch
=
state
.
commitAction
!==
consts
.
COMMIT_TO_CURRENT_BRANCH
;
const
payload
=
createCommitPayload
(
const
payload
=
createCommitPayload
(
getters
.
branchName
,
newBranch
,
state
,
rootState
);
getters
.
branchName
,
const
getCommitStatus
=
newBranch
?
Promise
.
resolve
(
false
)
:
dispatch
(
'
checkCommitStatus
'
);
newBranch
,
state
,
rootState
,
);
const
getCommitStatus
=
newBranch
?
Promise
.
resolve
(
false
)
:
dispatch
(
'
checkCommitStatus
'
);
commit
(
types
.
UPDATE_LOADING
,
true
);
commit
(
types
.
UPDATE_LOADING
,
true
);
...
@@ -182,12 +163,16 @@ export const commitChanges = ({
...
@@ -182,12 +163,16 @@ export const commitChanges = ({
if
(
!
data
.
short_id
)
{
if
(
!
data
.
short_id
)
{
flash
(
data
.
message
,
'
alert
'
,
document
,
null
,
false
,
true
);
flash
(
data
.
message
,
'
alert
'
,
document
,
null
,
false
,
true
);
return
;
return
null
;
}
}
dispatch
(
'
setLastCommitMessage
'
,
data
);
dispatch
(
'
setLastCommitMessage
'
,
data
);
dispatch
(
'
updateCommitMessage
'
,
''
);
dispatch
(
'
updateCommitMessage
'
,
''
);
return
dispatch
(
'
updateFilesAfterCommit
'
,
{
data
,
branch
:
getters
.
branchName
,
})
.
then
(()
=>
{
if
(
state
.
commitAction
===
consts
.
COMMIT_TO_NEW_BRANCH_MR
)
{
if
(
state
.
commitAction
===
consts
.
COMMIT_TO_NEW_BRANCH_MR
)
{
dispatch
(
dispatch
(
'
redirectToUrl
'
,
'
redirectToUrl
'
,
...
@@ -198,13 +183,10 @@ export const commitChanges = ({
...
@@ -198,13 +183,10 @@ export const commitChanges = ({
),
),
{
root
:
true
},
{
root
:
true
},
);
);
}
else
{
dispatch
(
'
updateFilesAfterCommit
'
,
{
data
,
branch
:
getters
.
branchName
,
});
}
}
})
})
.
then
(()
=>
dispatch
(
'
updateCommitAction
'
,
consts
.
COMMIT_TO_CURRENT_BRANCH
));
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
let
errMsg
=
__
(
'
Error committing changes. Please try again.
'
);
let
errMsg
=
__
(
'
Error committing changes. Please try again.
'
);
if
(
err
.
response
.
data
&&
err
.
response
.
data
.
message
)
{
if
(
err
.
response
.
data
&&
err
.
response
.
data
.
message
)
{
...
...
changelogs/unreleased/ide-mr-changes-alert-box.yml
0 → 100644
View file @
4e56af3b
---
title
:
Removed alert box in IDE when redirecting to new merge request
merge_request
:
author
:
type
:
fixed
spec/javascripts/ide/stores/modules/commit/actions_spec.js
View file @
4e56af3b
...
@@ -133,10 +133,7 @@ describe('IDE commit module actions', () => {
...
@@ -133,10 +133,7 @@ describe('IDE commit module actions', () => {
store
store
.
dispatch
(
'
commit/checkCommitStatus
'
)
.
dispatch
(
'
commit/checkCommitStatus
'
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
service
.
getBranchData
).
toHaveBeenCalledWith
(
expect
(
service
.
getBranchData
).
toHaveBeenCalledWith
(
'
abcproject
'
,
'
master
'
);
'
abcproject
'
,
'
master
'
,
);
done
();
done
();
})
})
...
@@ -230,9 +227,7 @@ describe('IDE commit module actions', () => {
...
@@ -230,9 +227,7 @@ describe('IDE commit module actions', () => {
branch
,
branch
,
})
})
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
expect
(
store
.
state
.
projects
.
abcproject
.
branches
.
master
.
workingReference
).
toBe
(
data
.
id
);
store
.
state
.
projects
.
abcproject
.
branches
.
master
.
workingReference
,
).
toBe
(
data
.
id
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
@@ -317,9 +312,7 @@ describe('IDE commit module actions', () => {
...
@@ -317,9 +312,7 @@ describe('IDE commit module actions', () => {
branch
,
branch
,
})
})
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
router
.
push
).
toHaveBeenCalledWith
(
expect
(
router
.
push
).
toHaveBeenCalledWith
(
`/project/abcproject/blob/master/
${
f
.
path
}
`
);
`/project/abcproject/blob/master/
${
f
.
path
}
`
,
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
@@ -334,9 +327,7 @@ describe('IDE commit module actions', () => {
...
@@ -334,9 +327,7 @@ describe('IDE commit module actions', () => {
branch
,
branch
,
})
})
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
store
.
state
.
commit
.
commitAction
).
not
.
toBe
(
expect
(
store
.
state
.
commit
.
commitAction
).
not
.
toBe
(
consts
.
COMMIT_TO_NEW_BRANCH
);
consts
.
COMMIT_TO_NEW_BRANCH
,
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
@@ -448,15 +439,14 @@ describe('IDE commit module actions', () => {
...
@@ -448,15 +439,14 @@ describe('IDE commit module actions', () => {
store
store
.
dispatch
(
'
commit/commitChanges
'
)
.
dispatch
(
'
commit/commitChanges
'
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
store
.
state
.
openFiles
[
0
].
lastCommit
.
message
).
toBe
(
expect
(
store
.
state
.
openFiles
[
0
].
lastCommit
.
message
).
toBe
(
'
test message
'
);
'
test message
'
,
);
done
();
done
();
})
})
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
describe
(
'
merge request
'
,
()
=>
{
it
(
'
redirects to new merge request page
'
,
done
=>
{
it
(
'
redirects to new merge request page
'
,
done
=>
{
spyOn
(
eventHub
,
'
$on
'
);
spyOn
(
eventHub
,
'
$on
'
);
...
@@ -475,6 +465,22 @@ describe('IDE commit module actions', () => {
...
@@ -475,6 +465,22 @@ describe('IDE commit module actions', () => {
})
})
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
resets changed files before redirecting
'
,
done
=>
{
spyOn
(
eventHub
,
'
$on
'
);
store
.
state
.
commit
.
commitAction
=
'
3
'
;
store
.
dispatch
(
'
commit/commitChanges
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
changedFiles
.
length
).
toBe
(
0
);
done
();
})
.
catch
(
done
.
fail
);
});
});
});
});
describe
(
'
failed
'
,
()
=>
{
describe
(
'
failed
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment