BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
daf88e02
Commit
daf88e02
authored
Jan 02, 2018
by
LUKE BENNETT
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10-3-stable-patch-3' into '10-3-stable'
Prepare 10.3.3 release See merge request gitlab-org/gitlab-ce!16163
parents
5fbc5f2f
f5c2ad7f
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
95 additions
and
9 deletions
+95
-9
diff_discussion.rb
app/models/diff_discussion.rb
+7
-2
_recaptcha_form.html.haml
app/views/shared/_recaptcha_form.html.haml
+2
-1
41492-mr-comment-fix.yml
changelogs/unreleased/41492-mr-comment-fix.yml
+5
-0
sh-fix-spam-update-404.yml
changelogs/unreleased/sh-fix-spam-update-404.yml
+5
-0
sh-handle-orphaned-deploy-keys.yml
changelogs/unreleased/sh-handle-orphaned-deploy-keys.yml
+5
-0
internal.rb
lib/api/internal.rb
+5
-2
repository.rb
lib/gitlab/git/repository.rb
+2
-2
diff_discussion_spec.rb
spec/models/diff_discussion_spec.rb
+38
-2
internal_spec.rb
spec/requests/api/internal_spec.rb
+10
-0
system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+16
-0
No files found.
app/models/diff_discussion.rb
View file @
daf88e02
...
...
@@ -23,8 +23,13 @@ class DiffDiscussion < Discussion
def
merge_request_version_params
return
unless
for_merge_request?
version_params
=
get_params
return
version_params
unless
on_merge_request_commit?
&&
commit_id
version_params
||=
{}
version_params
.
tap
do
|
params
|
params
[
:commit_id
]
=
commit_id
if
on_merge_request_commit?
params
[
:commit_id
]
=
commit_id
end
end
...
...
@@ -37,7 +42,7 @@ class DiffDiscussion < Discussion
private
def
version
_params
def
get
_params
return
{}
if
active?
noteable
.
version_params_for
(
position
.
diff_refs
)
...
...
app/views/shared/_recaptcha_form.html.haml
View file @
daf88e02
-
resource_name
=
spammable
.
class
.
model_name
.
singular
-
humanized_resource_name
=
spammable
.
class
.
model_name
.
human
.
downcase
-
script
=
local_assigns
.
fetch
(
:script
,
true
)
-
method
=
params
[
:action
]
==
'create'
?
:
post
:
:put
-
has_submit
=
local_assigns
.
fetch
(
:has_submit
,
true
)
=
form_for
resource_name
,
method:
:post
,
html:
{
class:
'recaptcha-form js-recaptcha-form'
}
do
|
f
|
=
form_for
resource_name
,
method:
method
,
html:
{
class:
'recaptcha-form js-recaptcha-form'
}
do
|
f
|
.recaptcha
-
params
[
resource_name
].
each
do
|
field
,
value
|
=
hidden_field
(
resource_name
,
field
,
value:
value
)
...
...
changelogs/unreleased/41492-mr-comment-fix.yml
0 → 100644
View file @
daf88e02
---
title
:
Fix links to old commits in merge request comments
merge_request
:
author
:
type
:
fixed
changelogs/unreleased/sh-fix-spam-update-404.yml
0 → 100644
View file @
daf88e02
---
title
:
Fix 404 errors after a user edits an issue description and solves the reCAPTCHA
merge_request
:
author
:
type
:
fixed
changelogs/unreleased/sh-handle-orphaned-deploy-keys.yml
0 → 100644
View file @
daf88e02
---
title
:
Gracefully handle orphaned write deploy keys in /internal/post_receive
merge_request
:
author
:
type
:
fixed
lib/api/internal.rb
View file @
daf88e02
...
...
@@ -190,9 +190,12 @@ module API
project
=
Gitlab
::
GlRepository
.
parse
(
params
[
:gl_repository
]).
first
user
=
identify
(
params
[
:identifier
])
# A user is not guaranteed to be returned; an orphaned write deploy
# key could be used
if
user
redirect_message
=
Gitlab
::
Checks
::
ProjectMoved
.
fetch_redirect_message
(
user
.
id
,
project
.
id
)
if
redirect_message
output
[
:redirected_message
]
=
redirect_message
output
[
:redirected_message
]
=
redirect_message
if
redirect_message
end
output
...
...
lib/gitlab/git/repository.rb
View file @
daf88e02
...
...
@@ -104,7 +104,7 @@ module Gitlab
end
def
exists?
Gitlab
::
GitalyClient
.
migrate
(
:repository_exists
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
enabled
|
Gitlab
::
GitalyClient
.
migrate
(
:repository_exists
)
do
|
enabled
|
if
enabled
gitaly_repository_client
.
exists?
else
...
...
@@ -166,7 +166,7 @@ module Gitlab
end
def
local_branches
(
sort_by:
nil
)
gitaly_migrate
(
:local_branches
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
is_enabled
|
gitaly_migrate
(
:local_branches
)
do
|
is_enabled
|
if
is_enabled
gitaly_ref_client
.
local_branches
(
sort_by:
sort_by
)
else
...
...
spec/models/diff_discussion_spec.rb
View file @
daf88e02
...
...
@@ -47,11 +47,23 @@ describe DiffDiscussion do
diff_note
.
save!
end
context
'when commit_id is not present'
do
it
'returns the diff ID for the version to show'
do
expect
(
subject
.
merge_request_version_params
).
to
eq
(
diff_id:
merge_request_diff1
.
id
)
end
end
context
'when commit_id is present'
do
before
do
diff_note
.
update_attribute
(
:commit_id
,
'commit_123'
)
end
it
'includes the commit_id in the result'
do
expect
(
subject
.
merge_request_version_params
).
to
eq
(
diff_id:
merge_request_diff1
.
id
,
commit_id:
'commit_123'
)
end
end
end
context
'when the discussion is on a comparison between merge request versions'
do
let
(
:position
)
do
Gitlab
::
Diff
::
Position
.
new
(
...
...
@@ -70,11 +82,23 @@ describe DiffDiscussion do
diff_note
.
save!
end
context
'when commit_id is not present'
do
it
'returns the diff ID and start sha of the versions to compare'
do
expect
(
subject
.
merge_request_version_params
).
to
eq
(
diff_id:
merge_request_diff3
.
id
,
start_sha:
merge_request_diff1
.
head_commit_sha
)
end
end
context
'when commit_id is present'
do
before
do
diff_note
.
update_attribute
(
:commit_id
,
'commit_123'
)
end
it
'includes the commit_id in the result'
do
expect
(
subject
.
merge_request_version_params
).
to
eq
(
diff_id:
merge_request_diff3
.
id
,
start_sha:
merge_request_diff1
.
head_commit_sha
,
commit_id:
'commit_123'
)
end
end
end
context
'when the discussion does not have a merge request version'
do
let
(
:diff_note
)
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
,
diff_refs:
project
.
commit
(
sample_commit
.
id
).
diff_refs
)
}
...
...
@@ -83,8 +107,20 @@ describe DiffDiscussion do
diff_note
.
save!
end
it
'returns nil'
do
expect
(
subject
.
merge_request_version_params
).
to
be_nil
context
'when commit_id is not present'
do
it
'returns empty hash'
do
expect
(
subject
.
merge_request_version_params
).
to
eq
(
nil
)
end
end
context
'when commit_id is present'
do
before
do
diff_note
.
update_attribute
(
:commit_id
,
'commit_123'
)
end
it
'returns the commit_id'
do
expect
(
subject
.
merge_request_version_params
).
to
eq
(
commit_id:
'commit_123'
)
end
end
end
end
...
...
spec/requests/api/internal_spec.rb
View file @
daf88e02
...
...
@@ -784,6 +784,16 @@ describe API::Internal do
expect
(
json_response
[
"redirected_message"
]).
to
eq
(
project_moved
.
redirect_message
)
end
end
context
'with an orphaned write deploy key'
do
it
'does not try to notify that project moved'
do
allow_any_instance_of
(
Gitlab
::
Identifier
).
to
receive
(
:identify
).
and_return
(
nil
)
post
api
(
"/internal/post_receive"
),
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
end
describe
'POST /internal/pre_receive'
do
...
...
spec/services/system_note_service_spec.rb
View file @
daf88e02
...
...
@@ -2,6 +2,7 @@ require 'spec_helper'
describe
SystemNoteService
do
include
Gitlab
::
Routing
include
RepoHelpers
set
(
:group
)
{
create
(
:group
)
}
set
(
:project
)
{
create
(
:project
,
:repository
,
group:
group
)
}
...
...
@@ -1070,6 +1071,7 @@ describe SystemNoteService do
let
(
:action
)
{
'outdated'
}
end
context
'when the change_position is valid for the discussion'
do
it
'creates a new note in the discussion'
do
# we need to completely rebuild the merge request object, or the `@discussions` on the merge request are not reloaded.
expect
{
subject
}.
to
change
{
reloaded_merge_request
.
discussions
.
first
.
notes
.
size
}.
by
(
1
)
...
...
@@ -1084,6 +1086,20 @@ describe SystemNoteService do
end
end
context
'when the change_position is invalid for the discussion'
do
let
(
:change_position
)
{
project
.
commit
(
sample_commit
.
id
)
}
it
'creates a new note in the discussion'
do
# we need to completely rebuild the merge request object, or the `@discussions` on the merge request are not reloaded.
expect
{
subject
}.
to
change
{
reloaded_merge_request
.
discussions
.
first
.
notes
.
size
}.
by
(
1
)
end
it
'does not create a link'
do
expect
(
subject
.
note
).
to
eq
(
'changed this line in version 1 of the diff'
)
end
end
end
describe
'.mark_duplicate_issue'
do
subject
{
described_class
.
mark_duplicate_issue
(
noteable
,
project
,
author
,
canonical_issue
)
}
...
...
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