Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
76c2901e
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
76c2901e
编写于
8月 18, 2016
作者:
T
tiagonbotelho
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
if issue is not valid we revert back to the old labels when updating
上级
7f0bcf04
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
19 deletion
+17
-19
CHANGELOG
CHANGELOG
+1
-1
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+13
-0
lib/api/helpers.rb
lib/api/helpers.rb
+0
-8
lib/api/issues.rb
lib/api/issues.rb
+2
-9
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+1
-1
未找到文件。
CHANGELOG
浏览文件 @
76c2901e
...
...
@@ -45,6 +45,7 @@ v 8.12.0 (unreleased)
v 8.11.4 (unreleased)
- Fix broken gitlab:backup:restore because of bad permissions on repo storage !6098 (Dirk Hörner)
- Creating an issue through our API now emails label subscribers !5720
v 8.11.3 (unreleased)
- Allow system info page to handle case where info is unavailable
...
...
@@ -70,7 +71,6 @@ v 8.11.0
- Remove the http_parser.rb dependency by removing the tinder gem. !5758 (tbalthazar)
- Add Koding (online IDE) integration
- Ability to specify branches for Pivotal Tracker integration (Egor Lynko)
- Creating an issue through our API now emails label subscribers !5720
- Fix don't pass a local variable called `i` to a partial. !20510 (herminiotorres)
- Fix rename `add_users_into_project` and `projects_ids`. !20512 (herminiotorres)
- Fix adding line comments on the initial commit to a repo !5900
...
...
app/services/issuable_base_service.rb
浏览文件 @
76c2901e
...
...
@@ -45,6 +45,7 @@ class IssuableBaseService < BaseService
unless
can?
(
current_user
,
ability
,
project
)
params
.
delete
(
:milestone_id
)
params
.
delete
(
:labels
)
params
.
delete
(
:add_label_ids
)
params
.
delete
(
:remove_label_ids
)
params
.
delete
(
:label_ids
)
...
...
@@ -72,6 +73,7 @@ class IssuableBaseService < BaseService
filter_labels_in_param
(
:add_label_ids
)
filter_labels_in_param
(
:remove_label_ids
)
filter_labels_in_param
(
:label_ids
)
find_or_create_label_ids
end
def
filter_labels_in_param
(
key
)
...
...
@@ -80,6 +82,17 @@ class IssuableBaseService < BaseService
params
[
key
]
=
project
.
labels
.
where
(
id:
params
[
key
]).
pluck
(
:id
)
end
def
find_or_create_label_ids
labels
=
params
.
delete
(
:labels
)
return
unless
labels
params
[
:label_ids
]
=
labels
.
split
(
","
).
map
do
|
label_name
|
project
.
labels
.
create_with
(
color:
Label
::
DEFAULT_COLOR
)
.
find_or_create_by
(
title:
label_name
.
strip
)
.
id
end
end
def
process_label_ids
(
attributes
,
existing_label_ids:
nil
)
label_ids
=
attributes
.
delete
(
:label_ids
)
add_label_ids
=
attributes
.
delete
(
:add_label_ids
)
...
...
lib/api/helpers.rb
浏览文件 @
76c2901e
...
...
@@ -102,14 +102,6 @@ module API
label
||
not_found!
(
'Label'
)
end
def
get_label_ids
(
labels
)
labels
.
split
(
","
).
map
do
|
label_name
|
user_project
.
labels
.
create_with
(
color:
Label
::
DEFAULT_COLOR
)
.
find_or_create_by
(
title:
label_name
.
strip
)
.
id
end
end
def
find_project_issue
(
id
)
issue
=
user_project
.
issues
.
find
(
id
)
not_found!
unless
can?
(
current_user
,
:read_issue
,
issue
)
...
...
lib/api/issues.rb
浏览文件 @
76c2901e
...
...
@@ -154,9 +154,7 @@ module API
render_api_error!
({
labels:
errors
},
400
)
end
# Find or create labels to attach to the issue. Labels are vaild
# because we already checked its name, so there can't be an error here
attrs
[
:label_ids
]
=
get_label_ids
(
params
[
:labels
])
if
params
[
:labels
].
present?
attrs
[
:labels
]
=
params
[
:labels
]
if
params
[
:labels
]
issue
=
::
Issues
::
CreateService
.
new
(
user_project
,
current_user
,
attrs
.
merge
(
request:
request
,
api:
true
)).
execute
...
...
@@ -198,12 +196,7 @@ module API
render_api_error!
({
labels:
errors
},
400
)
end
# Find or create labels and attach to issue. Labels are valid because
# we already checked its name, so there can't be an error here
if
params
[
:labels
]
&&
can?
(
current_user
,
:admin_issue
,
user_project
)
issue
.
remove_labels
attrs
[
:label_ids
]
=
get_label_ids
(
params
[
:labels
])
end
attrs
[
:labels
]
=
params
[
:labels
]
if
params
[
:labels
]
issue
=
::
Issues
::
UpdateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
(
issue
)
...
...
spec/requests/api/issues_spec.rb
浏览文件 @
76c2901e
...
...
@@ -647,7 +647,7 @@ describe API::API, api: true do
end
it
"sends notifications for subscribers of newly added labels when issue is updated"
do
label
=
project
.
labels
.
first
label
=
create
(
:label
,
title:
'foo'
,
color:
'#FFAABB'
,
project:
project
)
label
.
toggle_subscription
(
user2
)
perform_enqueued_jobs
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录