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
bfefb74c
Commit
bfefb74c
authored
Jul 24, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
45db8e34
b70dbabb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
app/models/label.rb
app/models/label.rb
+1
-1
changelogs/unreleased/63730-fix-500-status-labels-pd.yml
changelogs/unreleased/63730-fix-500-status-labels-pd.yml
+5
-0
spec/models/label_spec.rb
spec/models/label_spec.rb
+13
-0
No files found.
app/models/label.rb
View file @
bfefb74c
...
...
@@ -33,7 +33,7 @@ class Label < ApplicationRecord
default_scope
{
order
(
title: :asc
)
}
scope
:templates
,
->
{
where
(
template:
true
)
}
scope
:templates
,
->
{
where
(
template:
true
,
type:
[
Label
.
name
,
nil
]
)
}
scope
:with_title
,
->
(
title
)
{
where
(
title:
title
)
}
scope
:with_lists_and_board
,
->
{
joins
(
lists: :board
).
merge
(
List
.
movable
)
}
scope
:on_project_boards
,
->
(
project_id
)
{
with_lists_and_board
.
where
(
boards:
{
project_id:
project_id
})
}
...
...
changelogs/unreleased/63730-fix-500-status-labels-pd.yml
0 → 100644
View file @
bfefb74c
---
title
:
Fix admin labels page when there are invalid records
merge_request
:
30885
author
:
type
:
fixed
spec/models/label_spec.rb
View file @
bfefb74c
...
...
@@ -193,4 +193,17 @@ describe Label do
expect
(
described_class
.
optionally_subscribed_by
(
nil
)).
to
match_array
([
label
,
label2
])
end
end
describe
'#templates'
do
context
'with invalid template labels'
do
it
'returns only valid template labels'
do
create
(
:label
)
# Project labels should not have template set to true
create
(
:label
,
template:
true
)
valid_template_label
=
described_class
.
create!
(
title:
'test'
,
template:
true
,
type:
nil
)
expect
(
described_class
.
templates
).
to
eq
([
valid_template_label
])
end
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