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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
4f6d1c1d
Commit
4f6d1c1d
authored
Oct 19, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Labels::CreateService to Labels::FindOrCreateService
parent
fc2c64fc
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
10 additions
and
10 deletions
+10
-10
app/models/project.rb
app/models/project.rb
+1
-1
app/services/boards/lists/generate_service.rb
app/services/boards/lists/generate_service.rb
+1
-1
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+1
-1
app/services/labels/find_or_create_service.rb
app/services/labels/find_or_create_service.rb
+1
-1
app/services/labels/transfer_service.rb
app/services/labels/transfer_service.rb
+1
-1
lib/gitlab/fogbugz_import/importer.rb
lib/gitlab/fogbugz_import/importer.rb
+1
-1
lib/gitlab/github_import/label_formatter.rb
lib/gitlab/github_import/label_formatter.rb
+1
-1
lib/gitlab/google_code_import/importer.rb
lib/gitlab/google_code_import/importer.rb
+1
-1
lib/gitlab/issues_labels.rb
lib/gitlab/issues_labels.rb
+1
-1
spec/services/labels/find_or_create_service_spec.rb
spec/services/labels/find_or_create_service_spec.rb
+1
-1
No files found.
app/models/project.rb
View file @
4f6d1c1d
...
...
@@ -734,7 +734,7 @@ class Project < ActiveRecord::Base
def
create_labels
Label
.
templates
.
each
do
|
label
|
params
=
label
.
attributes
.
except
(
'id'
,
'template'
,
'created_at'
,
'updated_at'
)
Labels
::
CreateService
.
new
(
owner
,
self
,
params
).
execute
Labels
::
FindOr
CreateService
.
new
(
owner
,
self
,
params
).
execute
end
end
...
...
app/services/boards/lists/generate_service.rb
View file @
4f6d1c1d
...
...
@@ -19,7 +19,7 @@ module Boards
end
def
find_or_create_label
(
params
)
::
Labels
::
CreateService
.
new
(
current_user
,
project
,
params
).
execute
::
Labels
::
FindOr
CreateService
.
new
(
current_user
,
project
,
params
).
execute
end
def
label_params
...
...
app/services/issuable_base_service.rb
View file @
4f6d1c1d
...
...
@@ -88,7 +88,7 @@ class IssuableBaseService < BaseService
return
unless
labels
params
[
:label_ids
]
=
labels
.
split
(
','
).
map
do
|
label_name
|
service
=
Labels
::
CreateService
.
new
(
current_user
,
project
,
title:
label_name
.
strip
)
service
=
Labels
::
FindOr
CreateService
.
new
(
current_user
,
project
,
title:
label_name
.
strip
)
label
=
service
.
execute
label
.
id
...
...
app/services/labels/create_service.rb
→
app/services/labels/
find_or_
create_service.rb
View file @
4f6d1c1d
module
Labels
class
CreateService
class
FindOr
CreateService
def
initialize
(
current_user
,
project
,
params
=
{})
@current_user
=
current_user
@group
=
project
.
group
...
...
app/services/labels/transfer_service.rb
View file @
4f6d1c1d
...
...
@@ -43,7 +43,7 @@ module Labels
def
find_or_create_label!
(
label
)
params
=
label
.
attributes
.
slice
(
'title'
,
'description'
,
'color'
)
new_label
=
CreateService
.
new
(
current_user
,
project
,
params
).
execute
new_label
=
FindOr
CreateService
.
new
(
current_user
,
project
,
params
).
execute
new_label
.
id
end
...
...
lib/gitlab/fogbugz_import/importer.rb
View file @
4f6d1c1d
...
...
@@ -75,7 +75,7 @@ module Gitlab
def
create_label
(
name
)
params
=
{
title:
name
,
color:
nice_label_color
(
name
)
}
::
Labels
::
CreateService
.
new
(
project
.
owner
,
project
,
params
).
execute
::
Labels
::
FindOr
CreateService
.
new
(
project
.
owner
,
project
,
params
).
execute
end
def
user_info
(
person_id
)
...
...
lib/gitlab/github_import/label_formatter.rb
View file @
4f6d1c1d
...
...
@@ -15,7 +15,7 @@ module Gitlab
def
create!
params
=
attributes
.
except
(
:project
)
service
=
::
Labels
::
CreateService
.
new
(
project
.
owner
,
project
,
params
)
service
=
::
Labels
::
FindOr
CreateService
.
new
(
project
.
owner
,
project
,
params
)
label
=
service
.
execute
raise
ActiveRecord
::
RecordInvalid
.
new
(
label
)
unless
label
.
persisted?
...
...
lib/gitlab/google_code_import/importer.rb
View file @
4f6d1c1d
...
...
@@ -234,7 +234,7 @@ module Gitlab
def
create_label
(
name
)
params
=
{
name:
name
,
color:
nice_label_color
(
name
)
}
::
Labels
::
CreateService
.
new
(
project
.
owner
,
project
,
params
).
execute
::
Labels
::
FindOr
CreateService
.
new
(
project
.
owner
,
project
,
params
).
execute
end
def
format_content
(
raw_content
)
...
...
lib/gitlab/issues_labels.rb
View file @
4f6d1c1d
...
...
@@ -19,7 +19,7 @@ module Gitlab
]
labels
.
each
do
|
params
|
::
Labels
::
CreateService
.
new
(
project
.
owner
,
project
).
execute
(
params
)
::
Labels
::
FindOr
CreateService
.
new
(
project
.
owner
,
project
).
execute
(
params
)
end
end
end
...
...
spec/services/labels/create_service_spec.rb
→
spec/services/labels/
find_or_
create_service_spec.rb
View file @
4f6d1c1d
require
'spec_helper'
describe
Labels
::
CreateService
,
services:
true
do
describe
Labels
::
FindOr
CreateService
,
services:
true
do
describe
'#execute'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
...
...
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