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
7978d4d3
Commit
7978d4d3
authored
Dec 11, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-12-11
parents
7df7ecc3
51300f76
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
62 additions
and
12 deletions
+62
-12
app/controllers/dashboard/projects_controller.rb
app/controllers/dashboard/projects_controller.rb
+1
-1
app/controllers/explore/projects_controller.rb
app/controllers/explore/projects_controller.rb
+1
-1
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+4
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+1
-1
app/models/event.rb
app/models/event.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+1
-0
app/models/note.rb
app/models/note.rb
+1
-1
app/views/admin/dashboard/index.html.haml
app/views/admin/dashboard/index.html.haml
+1
-1
changelogs/unreleased/28682-can-merge-branch-before-build-is-started.yml
...leased/28682-can-merge-branch-before-build-is-started.yml
+0
-5
changelogs/unreleased/fix-n-plus-1-queries-projects.yml
changelogs/unreleased/fix-n-plus-1-queries-projects.yml
+6
-0
spec/helpers/events_helper_spec.rb
spec/helpers/events_helper_spec.rb
+32
-0
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+12
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+1
-1
No files found.
app/controllers/dashboard/projects_controller.rb
View file @
7978d4d3
...
...
@@ -56,7 +56,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
projects
=
ProjectsFinder
.
new
(
params:
finder_params
,
current_user:
current_user
)
.
execute
.
includes
(
:route
,
:creator
,
namespace:
[
:route
,
:owner
])
.
includes
(
:route
,
:creator
,
:group
,
namespace:
[
:route
,
:owner
])
.
page
(
finder_params
[
:page
])
prepare_projects_for_rendering
(
projects
)
...
...
app/controllers/explore/projects_controller.rb
View file @
7978d4d3
...
...
@@ -57,7 +57,7 @@ class Explore::ProjectsController < Explore::ApplicationController
def
load_projects
projects
=
ProjectsFinder
.
new
(
current_user:
current_user
,
params:
params
)
.
execute
.
includes
(
:route
,
namespace: :route
)
.
includes
(
:route
,
:creator
,
:group
,
namespace:
[
:route
,
:owner
]
)
.
page
(
params
[
:page
])
.
without_count
...
...
app/helpers/events_helper.rb
View file @
7978d4d3
...
...
@@ -161,6 +161,10 @@ module EventsHelper
project_commit_url
(
event
.
project
,
event
.
note_target
,
anchor:
dom_id
(
event
.
target
))
elsif
event
.
project_snippet_note?
project_snippet_url
(
event
.
project
,
event
.
note_target
,
anchor:
dom_id
(
event
.
target
))
elsif
event
.
issue_note?
project_issue_url
(
event
.
project
,
id:
event
.
note_target
,
anchor:
dom_id
(
event
.
target
))
elsif
event
.
merge_request_note?
project_merge_request_url
(
event
.
project
,
id:
event
.
note_target
,
anchor:
dom_id
(
event
.
target
))
else
polymorphic_url
([
event
.
project
.
namespace
.
becomes
(
Namespace
),
event
.
project
,
event
.
note_target
],
...
...
app/helpers/projects_helper.rb
View file @
7978d4d3
...
...
@@ -4,7 +4,7 @@ module ProjectsHelper
prepend
::
EE
::
ProjectsHelper
def
link_to_project
(
project
)
link_to
[
project
.
namespace
.
becomes
(
Namespace
),
project
]
,
title:
h
(
project
.
name
)
do
link_to
namespace_project_path
(
namespace_id:
project
.
namespace
,
id:
project
)
,
title:
h
(
project
.
name
)
do
title
=
content_tag
(
:span
,
project
.
name
,
class:
'project-name'
)
if
project
.
namespace
...
...
app/models/event.rb
View file @
7978d4d3
...
...
@@ -87,7 +87,7 @@ class Event < ActiveRecord::Base
scope
:with_associations
,
->
do
# We're using preload for "push_event_payload" as otherwise the association
# is not always available (depending on the query being built).
includes
(
:author
,
:project
,
project:
:namespace
)
includes
(
:author
,
:project
,
project:
[
:project_feature
,
:import_data
,
:namespace
]
)
.
preload
(
:target
,
:push_event_payload
)
end
...
...
app/models/merge_request.rb
View file @
7978d4d3
...
...
@@ -980,6 +980,7 @@ class MergeRequest < ActiveRecord::Base
def
mergeable_ci_state?
return
true
unless
project
.
only_allow_merge_if_pipeline_succeeds?
return
true
unless
head_pipeline
actual_head_pipeline
&
.
success?
||
actual_head_pipeline
&
.
skipped?
end
...
...
app/models/note.rb
View file @
7978d4d3
...
...
@@ -131,7 +131,7 @@ class Note < ActiveRecord::Base
scope
:with_associations
,
->
do
# FYI noteable cannot be loaded for LegacyDiffNote for commits
includes
(
:author
,
:noteable
,
:updated_by
,
project:
[
:project_members
,
{
group:
[
:group_members
]
}])
project:
[
:project_members
,
:namespace
,
{
group:
[
:group_members
]
}])
end
scope
:with_metadata
,
->
{
includes
(
:system_note_metadata
)
}
...
...
app/views/admin/dashboard/index.html.haml
View file @
7978d4d3
...
...
@@ -174,7 +174,7 @@
%h4
Latest projects
-
@projects
.
each
do
|
project
|
%p
=
link_to
project
.
full_name
,
[
:admin
,
project
.
namespace
.
becomes
(
Namespace
),
project
]
,
class:
'str-truncated-60'
=
link_to
project
.
full_name
,
admin_project_path
(
project
)
,
class:
'str-truncated-60'
%span
.light.float-right
#{
time_ago_with_tooltip
(
project
.
created_at
)
}
.col-md-4
...
...
changelogs/unreleased/28682-can-merge-branch-before-build-is-started.yml
deleted
100644 → 0
View file @
7df7ecc3
---
title
:
Strictly require a pipeline to merge.
merge_request
:
22911
author
:
type
:
changed
changelogs/unreleased/fix-n-plus-1-queries-projects.yml
0 → 100644
View file @
7978d4d3
---
title
:
Fix some N+1 queries related to Admin Dashboard, User Dashboards and Activity
Stream
merge_request
:
23034
author
:
type
:
performance
spec/helpers/events_helper_spec.rb
View file @
7978d4d3
...
...
@@ -84,4 +84,36 @@ describe EventsHelper do
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
push_event_feed_url
(
event
))
end
end
describe
'#event_note_target_url'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:event
)
{
create
(
:event
,
project:
project
)
}
let
(
:project_base_url
)
{
namespace_project_url
(
namespace_id:
project
.
namespace
,
id:
project
)
}
subject
{
helper
.
event_note_target_url
(
event
)
}
it
'returns a commit note url'
do
event
.
target
=
create
(
:note_on_commit
,
note:
'+1 from me'
)
expect
(
subject
).
to
eq
(
"
#{
project_base_url
}
/commit/
#{
event
.
target
.
commit_id
}
#note_
#{
event
.
target
.
id
}
"
)
end
it
'returns a project snippet note url'
do
event
.
target
=
create
(
:note
,
:on_snippet
,
note:
'keep going'
)
expect
(
subject
).
to
eq
(
"
#{
project_base_url
}
/snippets/
#{
event
.
note_target
.
id
}
#note_
#{
event
.
target
.
id
}
"
)
end
it
'returns a project issue url'
do
event
.
target
=
create
(
:note_on_issue
,
note:
'nice work'
)
expect
(
subject
).
to
eq
(
"
#{
project_base_url
}
/issues/
#{
event
.
note_target
.
iid
}
#note_
#{
event
.
target
.
id
}
"
)
end
it
'returns a merge request url'
do
event
.
target
=
create
(
:note_on_merge_request
,
note:
'LGTM!'
)
expect
(
subject
).
to
eq
(
"
#{
project_base_url
}
/merge_requests/
#{
event
.
note_target
.
iid
}
#note_
#{
event
.
target
.
id
}
"
)
end
end
end
spec/helpers/projects_helper_spec.rb
View file @
7978d4d3
...
...
@@ -229,6 +229,18 @@ describe ProjectsHelper do
end
end
describe
'#link_to_project'
do
let
(
:group
)
{
create
(
:group
,
name:
'group name with space'
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
,
name:
'project name with space'
)
}
subject
{
link_to_project
(
project
)
}
it
'returns an HTML link to the project'
do
expect
(
subject
).
to
match
(
%r{/
#{
group
.
full_path
}
/
#{
project
.
path
}
}
)
expect
(
subject
).
to
include
(
'group name with space /'
)
expect
(
subject
).
to
include
(
'project name with space'
)
end
end
describe
'#link_to_member_avatar'
do
let
(
:user
)
{
build_stubbed
(
:user
)
}
let
(
:expected
)
{
double
}
...
...
spec/models/merge_request_spec.rb
View file @
7978d4d3
...
...
@@ -2036,7 +2036,7 @@ describe MergeRequest do
allow
(
subject
).
to
receive
(
:head_pipeline
)
{
nil
}
end
it
{
expect
(
subject
.
mergeable_ci_state?
).
to
be_
false
y
}
it
{
expect
(
subject
.
mergeable_ci_state?
).
to
be_
truth
y
}
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