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
520065bd
Commit
520065bd
authored
Jul 06, 2020
by
Micael Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some failing tests
parent
8b393c9f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
7 deletions
+14
-7
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
lib/api/entities/issuable_entity.rb
lib/api/entities/issuable_entity.rb
+5
-1
lib/api/entities/issuable_time_stats.rb
lib/api/entities/issuable_time_stats.rb
+1
-1
lib/api/entities/issue_basic.rb
lib/api/entities/issue_basic.rb
+4
-4
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+3
-0
No files found.
app/models/merge_request.rb
View file @
520065bd
...
...
@@ -1021,7 +1021,7 @@ class MergeRequest < ApplicationRecord
end
def
for_fork?
target_project
!=
source_project
target_project
_id
!=
source_project_id
end
# If the merge request closes any issues, save this information in the
...
...
lib/api/entities/issuable_entity.rb
View file @
520065bd
...
...
@@ -14,7 +14,11 @@ module API
super
end
def
issuable_metadata
def
issuable_metadata
(
user:
nil
)
# Because of the presence of the `user` parameter, we can't
# use the same lazy association.
return
Gitlab
::
IssuableMetadata
.
new
(
user
,
[
object
]).
data
[
object
.
id
]
if
user
lazy_issuable_metadata
end
...
...
lib/api/entities/issuable_time_stats.rb
View file @
520065bd
...
...
@@ -32,7 +32,7 @@ module API
end
def
total_time_spent
lazy_timelogs
.
sum
(
&
:time_spen
d
)
# rubocop:disable CodeReuse/ActiveRecord
lazy_timelogs
.
sum
(
&
:time_spen
t
)
# rubocop:disable CodeReuse/ActiveRecord
end
end
end
...
...
lib/api/entities/issue_basic.rb
View file @
520065bd
...
...
@@ -21,10 +21,10 @@ module API
issue
.
assignees
.
first
end
expose
(
:user_notes_count
)
{
|
issue
,
options
|
issuable_metadata
(
issue
,
options
,
:user_notes_count
)
}
expose
(
:merge_requests_count
)
{
|
issue
,
options
|
issuable_metadata
(
issue
,
options
,
:merge_requests_count
,
options
[
:current_user
])
}
expose
(
:upvotes
)
{
|
issue
,
options
|
issuable_metadata
(
issue
,
options
,
:upvotes
)
}
expose
(
:downvotes
)
{
|
issue
,
options
|
issuable_metadata
(
issue
,
options
,
:downvotes
)
}
expose
(
:user_notes_count
)
{
|
issue
,
options
|
issuable_metadata
.
user_notes_count
}
expose
(
:merge_requests_count
)
{
|
issue
,
options
|
issuable_metadata
(
user:
options
[
:current_user
]).
merge_requests_count
}
expose
(
:upvotes
)
{
|
issue
,
options
|
issuable_metadata
.
upvotes
}
expose
(
:downvotes
)
{
|
issue
,
options
|
issuable_metadata
.
downvotes
}
expose
:due_date
expose
:confidential
expose
:discussion_locked
...
...
lib/gitlab/search_results.rb
View file @
520065bd
...
...
@@ -27,6 +27,7 @@ module Gitlab
end
def
objects
(
scope
,
page:
nil
,
per_page:
DEFAULT_PER_PAGE
,
without_count:
true
,
preload_method:
nil
)
should_preload
=
preload_method
.
present?
collection
=
case
scope
when
'projects'
projects
...
...
@@ -39,9 +40,11 @@ module Gitlab
when
'users'
users
else
should_preload
=
false
Kaminari
.
paginate_array
([])
end
collection
=
collection
.
public_send
(
preload_method
)
if
should_preload
# rubocop:disable GitlabSecurity/PublicSend
collection
=
collection
.
page
(
page
).
per
(
per_page
)
without_count
?
collection
.
without_count
:
collection
...
...
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