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
48499b0d
Commit
48499b0d
authored
May 15, 2020
by
ASHUTOSH KUMAR SINGH
Committed by
Mayra Cabrera
May 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tag.rb
Changed TAGS_LIMIT to INSERTION_TAGS_LIMIT.
parent
e4855eb6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
ee/app/models/packages/tag.rb
ee/app/models/packages/tag.rb
+3
-3
ee/changelogs/unreleased-ee/aks-rename-tags-limit.yml
ee/changelogs/unreleased-ee/aks-rename-tags-limit.yml
+5
-0
ee/spec/models/packages/tag_spec.rb
ee/spec/models/packages/tag_spec.rb
+4
-3
No files found.
ee/app/models/packages/tag.rb
View file @
48499b0d
...
...
@@ -4,15 +4,15 @@ class Packages::Tag < ApplicationRecord
validates
:package
,
:name
,
presence:
true
TAGS_LIMIT
=
200
.
freeze
FOR_PACKAGES_
TAGS_LIMIT
=
200
.
freeze
NUGET_TAGS_SEPARATOR
=
' '
# https://docs.microsoft.com/en-us/nuget/reference/nuspec#tags
scope
:preload_package
,
->
{
preload
(
:package
)
}
scope
:with_name
,
->
(
name
)
{
where
(
name:
name
)
}
def
self
.
for_packages
(
packages
,
max_tags_limit
=
TAGS_LIMIT
)
def
self
.
for_packages
(
packages
)
where
(
package_id:
packages
.
select
(
:id
))
.
order
(
updated_at: :desc
)
.
limit
(
max_tags_limit
)
.
limit
(
FOR_PACKAGES_TAGS_LIMIT
)
end
end
ee/changelogs/unreleased-ee/aks-rename-tags-limit.yml
0 → 100644
View file @
48499b0d
---
title
:
Renaming TAGS_LIMIT constant to FOR_PACKAGES_TAGS_LIMIT
merge_request
:
31858
author
:
Ashutosh Kumar Singh
type
:
change
ee/spec/models/packages/tag_spec.rb
View file @
48499b0d
...
...
@@ -19,17 +19,18 @@ RSpec.describe Packages::Tag, type: :model do
describe
'.for_packages'
do
let
(
:package2
)
{
create
(
:package
,
project:
project
,
updated_at:
2
.
days
.
ago
)
}
let
(
:package3
)
{
create
(
:package
,
project:
project
,
updated_at:
1
.
day
.
ago
)
}
let
(
:tags_limit
)
{
Packages
::
Tag
::
TAGS_LIMIT
}
let!
(
:tag1
)
{
create
(
:packages_tag
,
package:
package
)
}
let!
(
:tag2
)
{
create
(
:packages_tag
,
package:
package2
)
}
let!
(
:tag3
)
{
create
(
:packages_tag
,
package:
package3
)
}
subject
{
described_class
.
for_packages
(
project
.
packages
,
tags_limit
)
}
subject
{
described_class
.
for_packages
(
project
.
packages
)
}
it
{
is_expected
.
to
match_array
([
tag1
,
tag2
,
tag3
])
}
context
'with too many tags'
do
let
(
:tags_limit
)
{
2
}
before
do
stub_const
(
'Packages::Tag::FOR_PACKAGES_TAGS_LIMIT'
,
2
)
end
it
{
is_expected
.
to
match_array
([
tag2
,
tag3
])
}
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