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
93f9c146
Commit
93f9c146
authored
Jul 05, 2021
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to use correct push code permissions
Issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/333776
parent
d9fab223
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
10 deletions
+28
-10
app/assets/javascripts/repository/components/blob_content_viewer.vue
...javascripts/repository/components/blob_content_viewer.vue
+4
-2
app/assets/javascripts/repository/queries/blob_info.query.graphql
...ts/javascripts/repository/queries/blob_info.query.graphql
+3
-1
spec/frontend/repository/components/blob_content_viewer_spec.js
...rontend/repository/components/blob_content_viewer_spec.js
+21
-7
No files found.
app/assets/javascripts/repository/components/blob_content_viewer.vue
View file @
93f9c146
...
@@ -65,6 +65,9 @@ export default {
...
@@ -65,6 +65,9 @@ export default {
isLoadingLegacyViewer
:
false
,
isLoadingLegacyViewer
:
false
,
activeViewerType
:
SIMPLE_BLOB_VIEWER
,
activeViewerType
:
SIMPLE_BLOB_VIEWER
,
project
:
{
project
:
{
userPermissions
:
{
pushCode
:
false
,
},
repository
:
{
repository
:
{
blobs
:
{
blobs
:
{
nodes
:
[
nodes
:
[
...
@@ -86,7 +89,6 @@ export default {
...
@@ -86,7 +89,6 @@ export default {
canLock
:
false
,
canLock
:
false
,
isLocked
:
false
,
isLocked
:
false
,
lockLink
:
''
,
lockLink
:
''
,
canModifyBlob
:
true
,
forkPath
:
''
,
forkPath
:
''
,
simpleViewer
:
{},
simpleViewer
:
{},
richViewer
:
null
,
richViewer
:
null
,
...
@@ -168,7 +170,7 @@ export default {
...
@@ -168,7 +170,7 @@ export default {
:path=
"path"
:path=
"path"
:name=
"blobInfo.name"
:name=
"blobInfo.name"
:replace-path=
"blobInfo.replacePath"
:replace-path=
"blobInfo.replacePath"
:can-push-code=
"
blobInfo.canModifyBlob
"
:can-push-code=
"
project.userPermissions.pushCode
"
/>
/>
</
template
>
</
template
>
</blob-header>
</blob-header>
...
...
app/assets/javascripts/repository/queries/blob_info.query.graphql
View file @
93f9c146
query
getBlobInfo
(
$projectPath
:
ID
!,
$filePath
:
String
!)
{
query
getBlobInfo
(
$projectPath
:
ID
!,
$filePath
:
String
!)
{
project
(
fullPath
:
$projectPath
)
{
project
(
fullPath
:
$projectPath
)
{
userPermissions
{
pushCode
}
repository
{
repository
{
blobs
(
paths
:
[
$filePath
])
{
blobs
(
paths
:
[
$filePath
])
{
nodes
{
nodes
{
...
@@ -15,7 +18,6 @@ query getBlobInfo($projectPath: ID!, $filePath: String!) {
...
@@ -15,7 +18,6 @@ query getBlobInfo($projectPath: ID!, $filePath: String!) {
storedExternally
storedExternally
rawPath
rawPath
replacePath
replacePath
canModifyBlob
simpleViewer
{
simpleViewer
{
fileType
fileType
tooLarge
tooLarge
...
...
spec/frontend/repository/components/blob_content_viewer_spec.js
View file @
93f9c146
...
@@ -37,7 +37,6 @@ const simpleMockData = {
...
@@ -37,7 +37,6 @@ const simpleMockData = {
canLock
:
true
,
canLock
:
true
,
isLocked
:
false
,
isLocked
:
false
,
lockLink
:
'
some_file.js/lock
'
,
lockLink
:
'
some_file.js/lock
'
,
canModifyBlob
:
true
,
forkPath
:
'
some_file.js/fork
'
,
forkPath
:
'
some_file.js/fork
'
,
simpleViewer
:
{
simpleViewer
:
{
fileType
:
'
text
'
,
fileType
:
'
text
'
,
...
@@ -56,16 +55,26 @@ const richMockData = {
...
@@ -56,16 +55,26 @@ const richMockData = {
renderError
:
null
,
renderError
:
null
,
},
},
};
};
const
userPermissionsMockData
=
{
userPermissions
:
{
pushCode
:
true
,
},
};
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
const
mockAxios
=
new
MockAdapter
(
axios
);
const
mockAxios
=
new
MockAdapter
(
axios
);
const
createComponentWithApollo
=
(
mockData
)
=>
{
const
createComponentWithApollo
=
(
mockData
,
mockPermissionData
=
true
)
=>
{
localVue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
const
mockResolver
=
jest
const
mockResolver
=
jest
.
fn
().
mockResolvedValue
({
.
fn
()
data
:
{
.
mockResolvedValue
({
data
:
{
project
:
{
repository
:
{
blobs
:
{
nodes
:
[
mockData
]
}
}
}
}
});
project
:
{
userPermissions
:
{
pushCode
:
mockPermissionData
},
repository
:
{
blobs
:
{
nodes
:
[
mockData
]
}
},
},
},
});
const
fakeApollo
=
createMockApollo
([[
blobInfoQuery
,
mockResolver
]]);
const
fakeApollo
=
createMockApollo
([[
blobInfoQuery
,
mockResolver
]]);
...
@@ -276,13 +285,16 @@ describe('Blob content viewer component', () => {
...
@@ -276,13 +285,16 @@ describe('Blob content viewer component', () => {
});
});
describe
(
'
BlobButtonGroup
'
,
()
=>
{
describe
(
'
BlobButtonGroup
'
,
()
=>
{
const
{
name
,
path
}
=
simpleMockData
;
const
{
name
,
path
,
replacePath
}
=
simpleMockData
;
const
{
userPermissions
:
{
pushCode
},
}
=
userPermissionsMockData
;
it
(
'
renders component
'
,
async
()
=>
{
it
(
'
renders component
'
,
async
()
=>
{
window
.
gon
.
current_user_id
=
1
;
window
.
gon
.
current_user_id
=
1
;
fullFactory
({
fullFactory
({
mockData
:
{
blobInfo
:
simpleMockData
},
mockData
:
{
blobInfo
:
simpleMockData
,
project
:
userPermissionsMockData
},
stubs
:
{
stubs
:
{
BlobContent
:
true
,
BlobContent
:
true
,
BlobButtonGroup
:
true
,
BlobButtonGroup
:
true
,
...
@@ -294,6 +306,8 @@ describe('Blob content viewer component', () => {
...
@@ -294,6 +306,8 @@ describe('Blob content viewer component', () => {
expect
(
findBlobButtonGroup
().
props
()).
toMatchObject
({
expect
(
findBlobButtonGroup
().
props
()).
toMatchObject
({
name
,
name
,
path
,
path
,
replacePath
,
canPushCode
:
pushCode
,
});
});
});
});
...
...
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