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
c5f16c4a
Commit
c5f16c4a
authored
Apr 19, 2022
by
Brian Williams
Committed by
David O'Regan
Apr 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rendering failure for the 'Verified' badge
Changelog: fixed
parent
0433e99a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
132 deletions
+30
-132
app/assets/javascripts/diffs/components/commit_item.vue
app/assets/javascripts/diffs/components/commit_item.vue
+1
-1
app/assets/javascripts/repository/components/last_commit.vue
app/assets/javascripts/repository/components/last_commit.vue
+1
-1
lib/api/entities/commit_with_link.rb
lib/api/entities/commit_with_link.rb
+1
-7
spec/frontend/diffs/components/commit_item_spec.js
spec/frontend/diffs/components/commit_item_spec.js
+5
-2
spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap
...ository/components/__snapshots__/last_commit_spec.js.snap
+0
-111
spec/frontend/repository/components/last_commit_spec.js
spec/frontend/repository/components/last_commit_spec.js
+21
-2
spec/serializers/commit_entity_spec.rb
spec/serializers/commit_entity_spec.rb
+1
-8
No files found.
app/assets/javascripts/diffs/components/commit_item.vue
View file @
c5f16c4a
...
@@ -103,7 +103,7 @@ export default {
...
@@ -103,7 +103,7 @@ export default {
>
>
<div
<div
v-if=
"commit.signature_html"
v-if=
"commit.signature_html"
v-
safe-html:
[$
options.safeHtmlConfig]=
"commit.signature_html
"
v-
html=
"commit.signature_html /* eslint-disable-line vue/no-v-html */
"
></div>
></div>
<commit-pipeline-status
<commit-pipeline-status
v-if=
"commit.pipeline_status_path"
v-if=
"commit.pipeline_status_path"
...
...
app/assets/javascripts/repository/components/last_commit.vue
View file @
c5f16c4a
...
@@ -171,7 +171,7 @@ export default {
...
@@ -171,7 +171,7 @@ export default {
<div
class=
"commit-actions flex-row"
>
<div
class=
"commit-actions flex-row"
>
<div
<div
v-if=
"commit.signatureHtml"
v-if=
"commit.signatureHtml"
v-
safe-html:
[$
options.safeHtmlConfig]=
"commit.signatureHtml
"
v-
html=
"commit.signatureHtml /* eslint-disable-line vue/no-v-html */
"
></div>
></div>
<div
v-if=
"commit.pipeline"
class=
"ci-status-link"
>
<div
v-if=
"commit.pipeline"
class=
"ci-status-link"
>
<gl-link
<gl-link
...
...
lib/api/entities/commit_with_link.rb
View file @
c5f16c4a
...
@@ -29,7 +29,7 @@ module API
...
@@ -29,7 +29,7 @@ module API
end
end
expose
:signature_html
,
if:
{
type: :full
}
do
|
commit
|
expose
:signature_html
,
if:
{
type: :full
}
do
|
commit
|
render
(
'projects/commit/_signature'
,
signature:
commit
.
signature
)
if
commit
.
has_signature?
::
CommitPresenter
.
new
(
commit
).
signature_html
end
end
expose
:prev_commit_id
,
if:
{
type: :full
}
do
|
commit
|
expose
:prev_commit_id
,
if:
{
type: :full
}
do
|
commit
|
...
@@ -50,12 +50,6 @@ module API
...
@@ -50,12 +50,6 @@ module API
pipelines_project_commit_path
(
pipeline_project
,
commit
.
id
,
ref:
pipeline_ref
)
pipelines_project_commit_path
(
pipeline_project
,
commit
.
id
,
ref:
pipeline_ref
)
end
end
def
render
(
*
args
)
return
unless
request
.
respond_to?
(
:render
)
&&
request
.
render
.
respond_to?
(
:call
)
request
.
render
.
call
(
*
args
)
end
end
end
end
end
end
end
spec/frontend/diffs/components/commit_item_spec.js
View file @
c5f16c4a
...
@@ -11,7 +11,9 @@ jest.mock('~/user_popovers');
...
@@ -11,7 +11,9 @@ jest.mock('~/user_popovers');
const
TEST_AUTHOR_NAME
=
'
test
'
;
const
TEST_AUTHOR_NAME
=
'
test
'
;
const
TEST_AUTHOR_EMAIL
=
'
test+test@gitlab.com
'
;
const
TEST_AUTHOR_EMAIL
=
'
test+test@gitlab.com
'
;
const
TEST_AUTHOR_GRAVATAR
=
`
${
TEST_HOST
}
/avatar/test?s=40`
;
const
TEST_AUTHOR_GRAVATAR
=
`
${
TEST_HOST
}
/avatar/test?s=40`
;
const
TEST_SIGNATURE_HTML
=
'
<a>Legit commit</a>
'
;
const
TEST_SIGNATURE_HTML
=
`<a class="btn gpg-status-box valid" data-content="signature-content" data-html="true" data-placement="top" data-title="signature-title" data-toggle="popover" role="button" tabindex="0">
Verified
</a>`
;
const
TEST_PIPELINE_STATUS_PATH
=
`
${
TEST_HOST
}
/pipeline/status`
;
const
TEST_PIPELINE_STATUS_PATH
=
`
${
TEST_HOST
}
/pipeline/status`
;
describe
(
'
diffs/components/commit_item
'
,
()
=>
{
describe
(
'
diffs/components/commit_item
'
,
()
=>
{
...
@@ -156,8 +158,9 @@ describe('diffs/components/commit_item', () => {
...
@@ -156,8 +158,9 @@ describe('diffs/components/commit_item', () => {
it
(
'
renders signature html
'
,
()
=>
{
it
(
'
renders signature html
'
,
()
=>
{
const
actionsElement
=
getCommitActionsElement
();
const
actionsElement
=
getCommitActionsElement
();
const
signatureElement
=
actionsElement
.
find
(
'
.gpg-status-box
'
);
expect
(
actionsElement
.
html
()).
toContain
(
TEST_SIGNATURE_HTML
);
expect
(
signatureElement
.
html
()).
toBe
(
TEST_SIGNATURE_HTML
);
});
});
});
});
...
...
spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap
View file @
c5f16c4a
...
@@ -106,114 +106,3 @@ exports[`Repository last commit component renders commit widget 1`] = `
...
@@ -106,114 +106,3 @@ exports[`Repository last commit component renders commit widget 1`] = `
</div>
</div>
</div>
</div>
`;
`;
exports[`Repository last commit component renders the signature HTML as returned by the backend 1`] = `
<div
class="well-segment commit gl-p-5 gl-w-full"
>
<user-avatar-link-stub
class="avatar-cell"
imgalt=""
imgcssclasses=""
imgsize="40"
imgsrc="https://test.com"
linkhref="/test"
tooltipplacement="top"
tooltiptext=""
username=""
/>
<div
class="commit-detail flex-list"
>
<div
class="commit-content qa-commit-content"
>
<gl-link-stub
class="commit-row-message item-title"
href="/commit/123"
>
Commit title
</gl-link-stub>
<!---->
<div
class="committer"
>
<gl-link-stub
class="commit-author-link js-user-link"
href="/test"
>
Test
</gl-link-stub>
authored
<timeago-tooltip-stub
cssclass=""
time="2019-01-01"
tooltipplacement="bottom"
/>
</div>
<!---->
</div>
<div
class="commit-actions flex-row"
>
<div>
<button>
Verified
</button>
</div>
<div
class="ci-status-link"
>
<gl-link-stub
class="js-commit-pipeline"
href="https://test.com/pipeline"
title="Pipeline: failed"
>
<ci-icon-stub
aria-label="Pipeline: failed"
cssclasses=""
size="24"
status="[object Object]"
/>
</gl-link-stub>
</div>
<gl-button-group-stub
class="gl-ml-4 js-commit-sha-group"
>
<gl-button-stub
buttontextclasses=""
category="primary"
class="gl-font-monospace"
data-testid="last-commit-id-label"
icon=""
label="true"
size="medium"
variant="default"
>
12345678
</gl-button-stub>
<clipboard-button-stub
category="secondary"
class="input-group-text"
size="medium"
text="123456789"
title="Copy commit SHA"
tooltipplacement="top"
variant="default"
/>
</gl-button-group-stub>
</div>
</div>
</div>
`;
spec/frontend/repository/components/last_commit_spec.js
View file @
c5f16c4a
...
@@ -143,11 +143,30 @@ describe('Repository last commit component', () => {
...
@@ -143,11 +143,30 @@ describe('Repository last commit component', () => {
});
});
it
(
'
renders the signature HTML as returned by the backend
'
,
async
()
=>
{
it
(
'
renders the signature HTML as returned by the backend
'
,
async
()
=>
{
factory
(
createCommitData
({
signatureHtml
:
'
<button>Verified</button>
'
}));
factory
(
createCommitData
({
signatureHtml
:
`<a
class="btn gpg-status-box valid"
data-content="signature-content"
data-html="true"
data-placement="top"
data-title="signature-title"
data-toggle="popover"
role="button"
tabindex="0"
>
Verified
</a>`
,
}),
);
await
nextTick
();
await
nextTick
();
expect
(
vm
.
element
).
toMatchSnapshot
();
expect
(
vm
.
find
(
'
.gpg-status-box
'
).
html
()).
toBe
(
`<a class="btn gpg-status-box valid" data-content="signature-content" data-html="true" data-placement="top" data-title="signature-title" data-toggle="popover" role="button" tabindex="0">
Verified
</a>`
,
);
});
});
it
(
'
sets correct CSS class if the commit message is empty
'
,
async
()
=>
{
it
(
'
sets correct CSS class if the commit message is empty
'
,
async
()
=>
{
...
...
spec/serializers/commit_entity_spec.rb
View file @
c5f16c4a
...
@@ -3,8 +3,6 @@
...
@@ -3,8 +3,6 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
CommitEntity
do
RSpec
.
describe
CommitEntity
do
let
(
:signature_html
)
{
'TEST'
}
let
(
:entity
)
do
let
(
:entity
)
do
described_class
.
new
(
commit
,
request:
request
)
described_class
.
new
(
commit
,
request:
request
)
end
end
...
@@ -16,11 +14,7 @@ RSpec.describe CommitEntity do
...
@@ -16,11 +14,7 @@ RSpec.describe CommitEntity do
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
before
do
before
do
render
=
double
(
'render'
)
allow
(
render
).
to
receive
(
:call
).
and_return
(
signature_html
)
allow
(
request
).
to
receive
(
:project
).
and_return
(
project
)
allow
(
request
).
to
receive
(
:project
).
and_return
(
project
)
allow
(
request
).
to
receive
(
:render
).
and_return
(
render
)
end
end
context
'when commit author is a user'
do
context
'when commit author is a user'
do
...
@@ -83,8 +77,7 @@ RSpec.describe CommitEntity do
...
@@ -83,8 +77,7 @@ RSpec.describe CommitEntity do
let
(
:commit
)
{
project
.
commit
(
TestEnv
::
BRANCH_SHA
[
'signed-commits'
])
}
let
(
:commit
)
{
project
.
commit
(
TestEnv
::
BRANCH_SHA
[
'signed-commits'
])
}
it
'exposes "signature_html"'
do
it
'exposes "signature_html"'
do
expect
(
request
.
render
).
to
receive
(
:call
)
expect
(
subject
.
fetch
(
:signature_html
)).
not_to
be_nil
expect
(
subject
.
fetch
(
:signature_html
)).
to
be
signature_html
end
end
end
end
...
...
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