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
d5802c91
Commit
d5802c91
authored
Oct 18, 2021
by
Eugenia Grieff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes `cached_issues_state_count` feature flag
- Remove cached_issues_state_count_enabled? method Changelog: other
parent
9573d754
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
71 deletions
+17
-71
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+2
-4
app/models/group.rb
app/models/group.rb
+0
-4
config/feature_flags/development/cached_issues_state_count.yml
...g/feature_flags/development/cached_issues_state_count.yml
+0
-8
spec/features/groups/issues_spec.rb
spec/features/groups/issues_spec.rb
+12
-35
spec/helpers/issuables_helper_spec.rb
spec/helpers/issuables_helper_spec.rb
+3
-20
No files found.
app/helpers/issuables_helper.rb
View file @
d5802c91
...
...
@@ -284,9 +284,7 @@ module IssuablesHelper
end
def
issuables_count_for_state
(
issuable_type
,
state
)
store_in_cache
=
parent
.
is_a?
(
Group
)
?
parent
.
cached_issues_state_count_enabled?
:
false
Gitlab
::
IssuablesCountForState
.
new
(
finder
,
store_in_redis_cache:
store_in_cache
)[
state
]
Gitlab
::
IssuablesCountForState
.
new
(
finder
,
store_in_redis_cache:
true
)[
state
]
end
def
close_issuable_path
(
issuable
)
...
...
@@ -442,7 +440,7 @@ module IssuablesHelper
end
def
format_count
(
issuable_type
,
count
,
threshold
)
if
issuable_type
==
:issues
&&
parent
.
is_a?
(
Group
)
&&
parent
.
cached_issues_state_count_enabled?
if
issuable_type
==
:issues
&&
parent
.
is_a?
(
Group
)
format_cached_count
(
threshold
,
count
)
else
number_with_delimiter
(
count
)
...
...
app/models/group.rb
View file @
d5802c91
...
...
@@ -760,10 +760,6 @@ class Group < Namespace
Timelog
.
in_group
(
self
)
end
def
cached_issues_state_count_enabled?
Feature
.
enabled?
(
:cached_issues_state_count
,
self
,
default_enabled: :yaml
)
end
def
organizations
::
CustomerRelations
::
Organization
.
where
(
group_id:
self
.
id
)
end
...
...
config/feature_flags/development/cached_issues_state_count.yml
deleted
100644 → 0
View file @
9573d754
---
name
:
cached_issues_state_count
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67418
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/333089
milestone
:
'
14.3'
type
:
development
group
:
group::product planning
default_enabled
:
false
spec/features/groups/issues_spec.rb
View file @
d5802c91
...
...
@@ -83,6 +83,18 @@ RSpec.describe 'Group issues page' do
end
end
it
'truncates issue counts if over the threshold'
,
:clean_gitlab_redis_cache
do
allow
(
Rails
.
cache
).
to
receive
(
:read
).
and_call_original
allow
(
Rails
.
cache
).
to
receive
(
:read
).
with
(
[
'group'
,
group
.
id
,
'issues'
],
{
expires_in:
Gitlab
::
IssuablesCountForState
::
CACHE_EXPIRES_IN
}
).
and_return
({
opened:
1050
,
closed:
500
,
all:
1550
})
visit
issues_group_path
(
group
)
expect
(
page
).
to
have_text
(
'Open 1.1k Closed 500 All 1.6k'
)
end
context
'when project is archived'
do
before
do
::
Projects
::
UpdateService
.
new
(
project
,
user_in_group
,
archived:
true
).
execute
...
...
@@ -94,41 +106,6 @@ RSpec.describe 'Group issues page' do
expect
(
page
).
not_to
have_content
issue
.
title
[
0
..
80
]
end
end
context
'when cached issues state count is enabled'
,
:clean_gitlab_redis_cache
do
before
do
stub_feature_flags
(
cached_issues_state_count:
true
)
end
it
'truncates issue counts if over the threshold'
do
allow
(
Rails
.
cache
).
to
receive
(
:read
).
and_call_original
allow
(
Rails
.
cache
).
to
receive
(
:read
).
with
(
[
'group'
,
group
.
id
,
'issues'
],
{
expires_in:
Gitlab
::
IssuablesCountForState
::
CACHE_EXPIRES_IN
}
).
and_return
({
opened:
1050
,
closed:
500
,
all:
1550
})
visit
issues_group_path
(
group
)
expect
(
page
).
to
have_text
(
'Open 1.1k Closed 500 All 1.6k'
)
end
end
context
'when cached issues state count is disabled'
,
:clean_gitlab_redis_cache
do
before
do
stub_feature_flags
(
cached_issues_state_count:
false
)
end
it
'does not truncate counts if they are over the threshold'
do
allow_next_instance_of
(
IssuesFinder
)
do
|
finder
|
allow
(
finder
).
to
receive
(
:count_by_state
).
and_return
(
true
)
.
and_return
({
opened:
1050
,
closed:
500
,
all:
1550
})
end
visit
issues_group_path
(
group
)
expect
(
page
).
to
have_text
(
'Open 1,050 Closed 500 All 1,550'
)
end
end
end
context
'projects with issues disabled'
do
...
...
spec/helpers/issuables_helper_spec.rb
View file @
d5802c91
...
...
@@ -169,26 +169,9 @@ RSpec.describe IssuablesHelper do
stub_const
(
"Gitlab::IssuablesCountForState::THRESHOLD"
,
1000
)
end
context
'when feature flag cached_issues_state_count is disabled'
do
before
do
stub_feature_flags
(
cached_issues_state_count:
false
)
end
it
'returns complete count'
do
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:opened
,
true
))
.
to
eq
(
'<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex">1,100</span>'
)
end
end
context
'when feature flag cached_issues_state_count is enabled'
do
before
do
stub_feature_flags
(
cached_issues_state_count:
true
)
end
it
'returns truncated count'
do
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:opened
,
true
))
.
to
eq
(
'<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex">1.1k</span>'
)
end
it
'returns truncated count'
do
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:opened
,
true
))
.
to
eq
(
'<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex">1.1k</span>'
)
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