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
50a62b47
Commit
50a62b47
authored
Sep 14, 2018
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter out archived projects from issue/mr count
Pass the 'non_archived' flag to finder methods
parent
ccce7c79
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
2 deletions
+40
-2
app/models/user.rb
app/models/user.rb
+2
-2
changelogs/unreleased/45754-issue-mr-and-archived-projects.yml
...elogs/unreleased/45754-issue-mr-and-archived-projects.yml
+5
-0
changelogs/unreleased/45754-open-issues-from-archived-project-listed-in-group-issue-board.yml
...ues-from-archived-project-listed-in-group-issue-board.yml
+5
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+28
-0
No files found.
app/models/user.rb
View file @
50a62b47
...
...
@@ -1176,13 +1176,13 @@ class User < ActiveRecord::Base
def
assigned_open_merge_requests_count
(
force:
false
)
Rails
.
cache
.
fetch
([
'users'
,
id
,
'assigned_open_merge_requests_count'
],
force:
force
,
expires_in:
20
.
minutes
)
do
MergeRequestsFinder
.
new
(
self
,
assignee_id:
self
.
id
,
state:
'opened'
).
execute
.
count
MergeRequestsFinder
.
new
(
self
,
assignee_id:
self
.
id
,
state:
'opened'
,
non_archived:
true
).
execute
.
count
end
end
def
assigned_open_issues_count
(
force:
false
)
Rails
.
cache
.
fetch
([
'users'
,
id
,
'assigned_open_issues_count'
],
force:
force
,
expires_in:
20
.
minutes
)
do
IssuesFinder
.
new
(
self
,
assignee_id:
self
.
id
,
state:
'opened'
).
execute
.
count
IssuesFinder
.
new
(
self
,
assignee_id:
self
.
id
,
state:
'opened'
,
non_archived:
true
).
execute
.
count
end
end
...
...
changelogs/unreleased/45754-issue-mr-and-archived-projects.yml
0 → 100644
View file @
50a62b47
---
title
:
Issue and MR count now ignores archived projects
merge_request
:
21721
author
:
type
:
fixed
changelogs/unreleased/45754-open-issues-from-archived-project-listed-in-group-issue-board.yml
0 → 100644
View file @
50a62b47
---
title
:
No longer show open issues from archived projects in group issue board
merge_request
:
21721
author
:
type
:
fixed
spec/models/user_spec.rb
View file @
50a62b47
...
...
@@ -2543,6 +2543,34 @@ describe User do
end
end
describe
'#assigned_open_merge_requests_count'
do
it
'returns number of open merge requests from non-archived projects'
do
user
=
create
(
:user
)
project
=
create
(
:project
,
:public
)
archived_project
=
create
(
:project
,
:public
,
:archived
)
create
(
:merge_request
,
source_project:
project
,
author:
user
,
assignee:
user
)
create
(
:merge_request
,
:closed
,
source_project:
project
,
author:
user
,
assignee:
user
)
create
(
:merge_request
,
source_project:
archived_project
,
author:
user
,
assignee:
user
)
expect
(
user
.
assigned_open_merge_requests_count
(
force:
true
)).
to
eq
1
end
end
describe
'#assigned_open_issues_count'
do
it
'returns number of open issues from non-archived projects'
do
user
=
create
(
:user
)
project
=
create
(
:project
,
:public
)
archived_project
=
create
(
:project
,
:public
,
:archived
)
create
(
:issue
,
project:
project
,
author:
user
,
assignees:
[
user
])
create
(
:issue
,
:closed
,
project:
project
,
author:
user
,
assignees:
[
user
])
create
(
:issue
,
project:
archived_project
,
author:
user
,
assignees:
[
user
])
expect
(
user
.
assigned_open_issues_count
(
force:
true
)).
to
eq
1
end
end
describe
'#personal_projects_count'
do
it
'returns the number of personal projects using a single query'
do
user
=
build
(
:user
)
...
...
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