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
b9c745f0
Commit
b9c745f0
authored
May 15, 2020
by
Mayra Cabrera
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'master'
Update tag.rb See merge request gitlab-org/gitlab!31858
parents
7ea4486a
48499b0d
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 @
b9c745f0
...
...
@@ -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 @
b9c745f0
---
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 @
b9c745f0
...
...
@@ -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