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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
0531631c
Commit
0531631c
authored
Jun 25, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable current branch option in commit form is user does not have permissions to push
parent
9b760c4c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
8 deletions
+21
-8
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
...ets/javascripts/ide/components/commit_sidebar/actions.vue
+11
-3
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
...javascripts/ide/components/commit_sidebar/radio_group.vue
+6
-4
app/assets/javascripts/ide/stores/getters.js
app/assets/javascripts/ide/stores/getters.js
+4
-1
No files found.
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
View file @
0531631c
...
...
@@ -10,7 +10,7 @@ export default {
},
computed
:
{
...
mapState
([
'
currentBranchId
'
,
'
changedFiles
'
,
'
stagedFiles
'
]),
...
mapGetters
([
'
currentProject
'
]),
...
mapGetters
([
'
currentProject
'
,
'
currentBranch
'
]),
commitToCurrentBranchText
()
{
return
sprintf
(
__
(
'
Commit to %{branchName} branch
'
),
...
...
@@ -23,7 +23,9 @@ export default {
},
},
mounted
()
{
if
(
this
.
disableMergeRequestRadio
)
{
if
(
!
this
.
currentBranch
.
can_push
)
{
this
.
updateCommitAction
(
consts
.
COMMIT_TO_NEW_BRANCH
);
}
else
if
(
this
.
disableMergeRequestRadio
)
{
this
.
updateCommitAction
(
consts
.
COMMIT_TO_CURRENT_BRANCH
);
}
},
...
...
@@ -33,6 +35,9 @@ export default {
commitToCurrentBranch
:
consts
.
COMMIT_TO_CURRENT_BRANCH
,
commitToNewBranch
:
consts
.
COMMIT_TO_NEW_BRANCH
,
commitToNewBranchMR
:
consts
.
COMMIT_TO_NEW_BRANCH_MR
,
currentBranchPermissionsTooltip
:
__
(
"
This option is disabled as you don't have write permissions for the current branch
"
,
),
};
</
script
>
...
...
@@ -40,10 +45,12 @@ export default {
<div
class=
"append-bottom-15 ide-commit-radios"
>
<radio-group
:value=
"$options.commitToCurrentBranch"
:checked=
"true"
:disabled=
"!currentBranch.can_push"
:title=
"$options.currentBranchPermissionsTooltip"
>
<span
v-html=
"commitToCurrentBranchText"
class=
"ide-radio-label"
>
</span>
</radio-group>
...
...
@@ -56,6 +63,7 @@ export default {
v-if=
"currentProject.merge_requests_enabled"
:value=
"$options.commitToNewBranchMR"
:label=
"__('Create a new branch and merge request')"
:title=
"__('This option is disabled while you still have unstaged changes')"
:show-input=
"true"
:disabled=
"disableMergeRequestRadio"
/>
...
...
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
View file @
0531631c
<
script
>
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
{
__
}
from
'
~/locale
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
export
default
{
...
...
@@ -32,14 +31,17 @@ export default {
required
:
false
,
default
:
false
,
},
title
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
},
computed
:
{
...
mapState
(
'
commit
'
,
[
'
commitAction
'
]),
...
mapGetters
(
'
commit
'
,
[
'
newBranchName
'
]),
tooltipTitle
()
{
return
this
.
disabled
?
__
(
'
This option is disabled while you still have unstaged changes
'
)
:
''
;
return
this
.
disabled
?
this
.
title
:
''
;
},
},
methods
:
{
...
...
app/assets/javascripts/ide/stores/getters.js
View file @
0531631c
...
...
@@ -82,10 +82,13 @@ export const getStagedFilesCountForPath = state => path =>
getChangesCountForFiles
(
state
.
stagedFiles
,
path
);
export
const
lastCommit
=
(
state
,
getters
)
=>
{
const
branch
=
getters
.
currentProject
&&
getters
.
current
Project
.
branches
[
state
.
currentBranchId
]
;
const
branch
=
getters
.
currentProject
&&
getters
.
current
Branch
;
return
branch
?
branch
.
commit
:
null
;
};
export
const
currentBranch
=
(
state
,
getters
)
=>
getters
.
currentProject
.
branches
[
state
.
currentBranchId
];
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export
default
()
=>
{};
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