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
Boxiang Sun
gitlab-ce
Commits
fed97a68
Commit
fed97a68
authored
Aug 02, 2018
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GPG status badge loading regressions
parent
313b79d8
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
146 additions
and
23 deletions
+146
-23
app/views/projects/blob/show.html.haml
app/views/projects/blob/show.html.haml
+2
-1
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+1
-1
app/views/projects/tree/show.html.haml
app/views/projects/tree/show.html.haml
+1
-1
changelogs/unreleased/winh-fix-gpg-regressions.yml
changelogs/unreleased/winh-fix-gpg-regressions.yml
+5
-0
spec/features/projects/blobs/blob_show_spec.rb
spec/features/projects/blobs/blob_show_spec.rb
+29
-0
spec/features/projects/tree/tree_show_spec.rb
spec/features/projects/tree/tree_show_spec.rb
+54
-10
spec/features/projects_spec.rb
spec/features/projects_spec.rb
+43
-0
spec/features/signed_commits_spec.rb
spec/features/signed_commits_spec.rb
+10
-9
spec/support/helpers/test_env.rb
spec/support/helpers/test_env.rb
+1
-1
No files found.
app/views/projects/blob/show.html.haml
View file @
fed97a68
...
...
@@ -3,7 +3,8 @@
-
page_title
@blob
.
path
,
@ref
.js-signature-container
{
data:
{
'signatures-path'
:
namespace_project_signatures_path
}
}
-
signatures_path
=
namespace_project_signatures_path
(
namespace_id:
@project
.
namespace
.
full_path
,
project_id:
@project
.
path
,
id:
@last_commit
)
.js-signature-container
{
data:
{
'signatures-path'
:
signatures_path
}
}
%div
{
class:
container_class
}
=
render
'projects/last_push'
...
...
app/views/projects/show.html.haml
View file @
fed97a68
...
...
@@ -9,7 +9,7 @@
=
render
partial:
'flash_messages'
,
locals:
{
project:
@project
}
-
if
@project
.
repository_exists?
&&
!
@project
.
empty_repo?
-
signatures_path
=
namespace_project_signatures_path
(
project_id:
@project
.
path
,
id:
@project
.
default_branch
)
-
signatures_path
=
namespace_project_signatures_path
(
namespace_id:
@project
.
namespace
.
full_path
,
project_id:
@project
.
path
,
id:
@project
.
default_branch
)
.js-signature-container
{
data:
{
'signatures-path'
:
signatures_path
}
}
%div
{
class:
[
container_class
,
(
"limit-container-width"
unless
fluid_layout
)]
}
...
...
app/views/projects/tree/show.html.haml
View file @
fed97a68
-
@no_container
=
true
-
breadcrumb_title
_
(
"Repository"
)
-
@content_class
=
"limit-container-width"
unless
fluid_layout
-
signatures_path
=
namespace_project_signatures_path
(
namespace_id:
@project
.
namespace
.
path
,
project_id:
@project
.
path
,
id:
@ref
)
-
signatures_path
=
namespace_project_signatures_path
(
namespace_id:
@project
.
namespace
.
full_path
,
project_id:
@project
.
path
,
id:
@last_commit
)
-
page_title
@path
.
presence
||
_
(
"Files"
),
@ref
=
content_for
:meta_tags
do
...
...
changelogs/unreleased/winh-fix-gpg-regressions.yml
0 → 100644
View file @
fed97a68
---
title
:
Fix GPG status badge loading regressions
merge_request
:
20987
author
:
type
:
fixed
spec/features/projects/blobs/blob_show_spec.rb
View file @
fed97a68
...
...
@@ -552,4 +552,33 @@ describe 'File blob', :js do
end
end
end
context
'for subgroups'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
group:
subgroup
)
}
it
'renders tree table without errors'
do
visit_blob
(
'README.md'
)
expect
(
page
).
to
have_selector
(
'.file-content'
)
expect
(
page
).
not_to
have_selector
(
'.flash-alert'
)
end
it
'displays a GPG badge'
do
visit_blob
(
'CONTRIBUTING.md'
,
ref:
'33f3729a45c02fc67d00adb1b8bca394b0e761d9'
)
expect
(
page
).
not_to
have_selector
'.gpg-status-box.js-loading-gpg-badge'
expect
(
page
).
to
have_selector
'.gpg-status-box.invalid'
end
end
context
'on signed merge commit'
do
it
'displays a GPG badge'
do
visit_blob
(
'conflicting-file.md'
,
ref:
'6101e87e575de14b38b4e1ce180519a813671e10'
)
expect
(
page
).
not_to
have_selector
'.gpg-status-box.js-loading-gpg-badge'
expect
(
page
).
to
have_selector
'.gpg-status-box.invalid'
end
end
end
spec/features/projects/tree/tree_show_spec.rb
View file @
fed97a68
require
'spec_helper'
describe
'Projects tree'
do
describe
'Projects tree'
,
:js
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
end
it
'renders tree table without errors'
do
visit
project_tree_path
(
project
,
'master'
)
end
wait_for_requests
it
'renders tree table'
do
expect
(
page
).
to
have_selector
(
'.tree-item'
)
expect
(
page
).
not_to
have_selector
(
'.label-lfs'
,
text:
'LFS'
)
expect
(
page
).
not_to
have_selector
(
'.flash-alert'
)
end
context
'LFS'
do
before
do
visit
project_tree_path
(
project
,
File
.
join
(
'master'
,
'files/lfs'
))
context
'for signed commit'
do
it
'displays a GPG badge'
do
visit
project_tree_path
(
project
,
'33f3729a45c02fc67d00adb1b8bca394b0e761d9'
)
wait_for_requests
expect
(
page
).
not_to
have_selector
'.gpg-status-box.js-loading-gpg-badge'
expect
(
page
).
to
have_selector
'.gpg-status-box.invalid'
end
context
'on a directory that has not changed recently'
do
it
'displays a GPG badge'
do
tree_path
=
File
.
join
(
'eee736adc74341c5d3e26cd0438bc697f26a7575'
,
'subdir'
)
visit
project_tree_path
(
project
,
tree_path
)
wait_for_requests
expect
(
page
).
not_to
have_selector
'.gpg-status-box.js-loading-gpg-badge'
expect
(
page
).
to
have_selector
'.gpg-status-box.invalid'
end
end
end
context
'LFS'
do
it
'renders LFS badge on blob item'
do
visit
project_tree_path
(
project
,
File
.
join
(
'master'
,
'files/lfs'
))
expect
(
page
).
to
have_selector
(
'.label-lfs'
,
text:
'LFS'
)
end
end
context
'web IDE'
,
:js
do
before
do
context
'web IDE'
do
it
'opens folder in IDE'
do
visit
project_tree_path
(
project
,
File
.
join
(
'master'
,
'bar'
))
click_link
'Web IDE'
wait_for_requests
find
(
'.ide-file-list'
)
wait_for_requests
expect
(
page
).
to
have_selector
(
'.is-open'
,
text:
'bar'
)
end
end
it
'opens folder in IDE'
do
expect
(
page
).
to
have_selector
(
'.is-open'
,
text:
'bar'
)
context
'for subgroups'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
group:
subgroup
)
}
it
'renders tree table without errors'
do
visit
project_tree_path
(
project
,
'master'
)
wait_for_requests
expect
(
page
).
to
have_selector
(
'.tree-item'
)
expect
(
page
).
not_to
have_selector
(
'.flash-alert'
)
end
context
'for signed commit'
do
it
'displays a GPG badge'
do
visit
project_tree_path
(
project
,
'33f3729a45c02fc67d00adb1b8bca394b0e761d9'
)
wait_for_requests
expect
(
page
).
not_to
have_selector
'.gpg-status-box.js-loading-gpg-badge'
expect
(
page
).
to
have_selector
'.gpg-status-box.invalid'
end
end
end
end
spec/features/projects_spec.rb
View file @
fed97a68
...
...
@@ -197,6 +197,49 @@ describe 'Project' do
expect
(
page
.
status_code
).
to
eq
(
200
)
end
context
'for signed commit on default branch'
,
:js
do
before
do
project
.
change_head
(
'33f3729a45c02fc67d00adb1b8bca394b0e761d9'
)
end
it
'displays a GPG badge'
do
visit
project_path
(
project
)
wait_for_requests
expect
(
page
).
not_to
have_selector
'.gpg-status-box.js-loading-gpg-badge'
expect
(
page
).
to
have_selector
'.gpg-status-box.invalid'
end
end
context
'for subgroups'
,
:js
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
group:
subgroup
)
}
it
'renders tree table without errors'
do
wait_for_requests
expect
(
page
).
to
have_selector
(
'.tree-item'
)
expect
(
page
).
not_to
have_selector
(
'.flash-alert'
)
end
context
'for signed commit'
do
before
do
repository
=
project
.
repository
repository
.
write_ref
(
"refs/heads/
#{
project
.
default_branch
}
"
,
'33f3729a45c02fc67d00adb1b8bca394b0e761d9'
)
repository
.
expire_branches_cache
end
it
'displays a GPG badge'
do
visit
project_path
(
project
)
wait_for_requests
expect
(
page
).
not_to
have_selector
'.gpg-status-box.js-loading-gpg-badge'
expect
(
page
).
to
have_selector
'.gpg-status-box.invalid'
end
end
end
end
describe
'activity view'
do
...
...
spec/features/signed_commits_spec.rb
View file @
fed97a68
require
'spec_helper'
describe
'GPG signed commits'
,
:js
do
set
(
:ref
)
{
:'2d1096e3a0ecf1d2baf6dee036cc80775d4940ba'
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it
'changes from unverified to verified when the user changes his email to match the gpg key'
do
...
...
@@ -13,7 +14,7 @@ describe 'GPG signed commits', :js do
sign_in
(
user
)
visit
project_commits_path
(
project
,
:'signed-commits'
)
visit
project_commits_path
(
project
,
ref
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
...
...
@@ -26,7 +27,7 @@ describe 'GPG signed commits', :js do
user
.
update!
(
email:
GpgHelpers
::
User1
.
emails
.
first
)
end
visit
project_commits_path
(
project
,
:'signed-commits'
)
visit
project_commits_path
(
project
,
ref
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
...
...
@@ -40,7 +41,7 @@ describe 'GPG signed commits', :js do
sign_in
(
user
)
visit
project_commits_path
(
project
,
:'signed-commits'
)
visit
project_commits_path
(
project
,
ref
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
...
...
@@ -52,7 +53,7 @@ describe 'GPG signed commits', :js do
create
:gpg_key
,
key:
GpgHelpers
::
User1
.
public_key
,
user:
user
end
visit
project_commits_path
(
project
,
:'signed-commits'
)
visit
project_commits_path
(
project
,
ref
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
...
...
@@ -92,7 +93,7 @@ describe 'GPG signed commits', :js do
end
it
'unverified signature'
do
visit
project_commits_path
(
project
,
:'signed-commits'
)
visit
project_commits_path
(
project
,
ref
)
within
(
find
(
'.commit'
,
text:
'signed commit by bette cartwright'
))
do
click_on
'Unverified'
...
...
@@ -107,7 +108,7 @@ describe 'GPG signed commits', :js do
it
'unverified signature: user email does not match the committer email, but is the same user'
do
user_2_key
visit
project_commits_path
(
project
,
:'signed-commits'
)
visit
project_commits_path
(
project
,
ref
)
within
(
find
(
'.commit'
,
text:
'signed and authored commit by bette cartwright, different email'
))
do
click_on
'Unverified'
...
...
@@ -124,7 +125,7 @@ describe 'GPG signed commits', :js do
it
'unverified signature: user email does not match the committer email'
do
user_2_key
visit
project_commits_path
(
project
,
:'signed-commits'
)
visit
project_commits_path
(
project
,
ref
)
within
(
find
(
'.commit'
,
text:
'signed commit by bette cartwright'
))
do
click_on
'Unverified'
...
...
@@ -141,7 +142,7 @@ describe 'GPG signed commits', :js do
it
'verified and the gpg user has a gitlab profile'
do
user_1_key
visit
project_commits_path
(
project
,
:'signed-commits'
)
visit
project_commits_path
(
project
,
ref
)
within
(
find
(
'.commit'
,
text:
'signed and authored commit by nannie bernhard'
))
do
click_on
'Verified'
...
...
@@ -158,7 +159,7 @@ describe 'GPG signed commits', :js do
it
"verified and the gpg user's profile doesn't exist anymore"
do
user_1_key
visit
project_commits_path
(
project
,
:'signed-commits'
)
visit
project_commits_path
(
project
,
ref
)
# wait for the signature to get generated
within
(
find
(
'.commit'
,
text:
'signed and authored commit by nannie bernhard'
))
do
...
...
spec/support/helpers/test_env.rb
View file @
fed97a68
...
...
@@ -8,7 +8,7 @@ module TestEnv
# When developing the seed repository, comment out the branch you will modify.
BRANCH_SHA
=
{
'signed-commits'
=>
'
2d1096e
'
,
'signed-commits'
=>
'
6101e87
'
,
'not-merged-branch'
=>
'b83d6e3'
,
'branch-merged'
=>
'498214d'
,
'empty-branch'
=>
'7efb185'
,
...
...
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