Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ef892bc2
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 搜索 >>
提交
ef892bc2
编写于
7月 14, 2016
作者:
K
Katarzyna Kobierska
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
When Issue author assign or mention himself Todos are created
上级
7968484d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
17 deletion
+22
-17
CHANGELOG
CHANGELOG
+1
-0
app/services/todo_service.rb
app/services/todo_service.rb
+1
-2
spec/services/todo_service_spec.rb
spec/services/todo_service_spec.rb
+20
-15
未找到文件。
CHANGELOG
浏览文件 @
ef892bc2
...
...
@@ -91,6 +91,7 @@ v 8.10.0 (unreleased)
- Redesign Builds and Pipelines pages
- Change status color and icon for running builds
- Fix markdown rendering for: consecutive labels references, label references that begin with a digit or contains `.`
- Create Todos for Issue author when assign or mention himself (Katarzyna Kobierska)
v 8.9.6
- Fix importing of events under notes for GitLab projects. !5154
...
...
app/services/todo_service.rb
浏览文件 @
ef892bc2
...
...
@@ -194,7 +194,7 @@ class TodoService
end
def
create_assignment_todo
(
issuable
,
author
)
if
issuable
.
assignee
&&
issuable
.
assignee
!=
author
if
issuable
.
assignee
attributes
=
attributes_for_todo
(
issuable
.
project
,
issuable
,
author
,
Todo
::
ASSIGNED
)
create_todos
(
issuable
.
assignee
,
attributes
)
end
...
...
@@ -239,7 +239,6 @@ class TodoService
def
filter_mentioned_users
(
project
,
target
,
author
)
mentioned_users
=
target
.
mentioned_users
(
author
)
mentioned_users
=
reject_users_without_access
(
mentioned_users
,
project
,
target
)
mentioned_users
.
delete
(
author
)
mentioned_users
.
uniq
end
...
...
spec/services/todo_service_spec.rb
浏览文件 @
ef892bc2
...
...
@@ -35,8 +35,11 @@ describe TodoService, services: true do
should_not_create_any_todo
{
service
.
new_issue
(
unassigned_issue
,
author
)
}
end
it
'does not create a todo if assignee is the current user'
do
should_not_create_any_todo
{
service
.
new_issue
(
unassigned_issue
,
john_doe
)
}
it
'creates a todo if assignee is the current user'
do
unassigned_issue
.
update_attribute
(
:assignee
,
john_doe
)
service
.
new_issue
(
unassigned_issue
,
john_doe
)
should_create_todo
(
user:
john_doe
,
target:
unassigned_issue
,
author:
john_doe
,
action:
Todo
::
ASSIGNED
)
end
it
'creates a todo for each valid mentioned user'
do
...
...
@@ -44,7 +47,7 @@ describe TodoService, services: true do
should_create_todo
(
user:
member
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
guest
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_
not_
create_todo
(
user:
author
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
author
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_not_create_todo
(
user:
john_doe
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_not_create_todo
(
user:
non_member
,
target:
issue
,
action:
Todo
::
MENTIONED
)
end
...
...
@@ -57,7 +60,7 @@ describe TodoService, services: true do
should_create_todo
(
user:
member
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
admin
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
should_not_create_todo
(
user:
guest
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
should_
not_
create_todo
(
user:
john_doe
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
john_doe
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
end
context
'when a private group is mentioned'
do
...
...
@@ -87,7 +90,7 @@ describe TodoService, services: true do
should_create_todo
(
user:
member
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
guest
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
john_doe
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_
not_
create_todo
(
user:
author
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
author
,
target:
issue
,
action:
Todo
::
MENTIONED
)
should_not_create_todo
(
user:
non_member
,
target:
issue
,
action:
Todo
::
MENTIONED
)
end
...
...
@@ -105,7 +108,7 @@ describe TodoService, services: true do
should_create_todo
(
user:
member
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
admin
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
should_not_create_todo
(
user:
guest
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
should_
not_
create_todo
(
user:
john_doe
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
john_doe
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
)
end
context
'issues with a task list'
do
...
...
@@ -156,10 +159,11 @@ describe TodoService, services: true do
should_not_create_any_todo
{
service
.
reassigned_issue
(
issue
,
author
)
}
end
it
'
does not create
a todo if new assignee is the current user'
do
it
'
creates
a todo if new assignee is the current user'
do
unassigned_issue
.
update_attribute
(
:assignee
,
john_doe
)
service
.
reassigned_issue
(
unassigned_issue
,
john_doe
)
should_
not_create_any_todo
{
service
.
reassigned_issue
(
unassigned_issue
,
john_doe
)
}
should_
create_todo
(
user:
john_doe
,
target:
unassigned_issue
,
author:
john_doe
,
action:
Todo
::
ASSIGNED
)
end
end
...
...
@@ -250,7 +254,7 @@ describe TodoService, services: true do
should_create_todo
(
user:
member
,
target:
issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note
)
should_create_todo
(
user:
guest
,
target:
issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note
)
should_create_todo
(
user:
author
,
target:
issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note
)
should_
not_
create_todo
(
user:
john_doe
,
target:
issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note
)
should_create_todo
(
user:
john_doe
,
target:
issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note
)
should_not_create_todo
(
user:
non_member
,
target:
issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note
)
end
...
...
@@ -262,7 +266,7 @@ describe TodoService, services: true do
should_create_todo
(
user:
member
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_confidential_issue
)
should_create_todo
(
user:
admin
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_confidential_issue
)
should_not_create_todo
(
user:
guest
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_confidential_issue
)
should_
not_
create_todo
(
user:
john_doe
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_confidential_issue
)
should_create_todo
(
user:
john_doe
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_confidential_issue
)
end
it
'creates a todo for each valid mentioned user when leaving a note on commit'
do
...
...
@@ -270,7 +274,7 @@ describe TodoService, services: true do
should_create_todo
(
user:
member
,
target_id:
nil
,
target_type:
'Commit'
,
commit_id:
note_on_commit
.
commit_id
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_commit
)
should_create_todo
(
user:
author
,
target_id:
nil
,
target_type:
'Commit'
,
commit_id:
note_on_commit
.
commit_id
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_commit
)
should_
not_
create_todo
(
user:
john_doe
,
target_id:
nil
,
target_type:
'Commit'
,
commit_id:
note_on_commit
.
commit_id
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_commit
)
should_create_todo
(
user:
john_doe
,
target_id:
nil
,
target_type:
'Commit'
,
commit_id:
note_on_commit
.
commit_id
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_commit
)
should_not_create_todo
(
user:
non_member
,
target_id:
nil
,
target_type:
'Commit'
,
commit_id:
note_on_commit
.
commit_id
,
author:
john_doe
,
action:
Todo
::
MENTIONED
,
note:
note_on_commit
)
end
...
...
@@ -312,7 +316,7 @@ describe TodoService, services: true do
should_create_todo
(
user:
member
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
guest
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_
not_
create_todo
(
user:
author
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
author
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_not_create_todo
(
user:
john_doe
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_not_create_todo
(
user:
non_member
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
end
...
...
@@ -325,7 +329,7 @@ describe TodoService, services: true do
should_create_todo
(
user:
member
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
guest
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
john_doe
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_
not_
create_todo
(
user:
author
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_create_todo
(
user:
author
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
should_not_create_todo
(
user:
non_member
,
target:
mr_assigned
,
action:
Todo
::
MENTIONED
)
end
...
...
@@ -382,10 +386,11 @@ describe TodoService, services: true do
should_not_create_any_todo
{
service
.
reassigned_merge_request
(
mr_assigned
,
author
)
}
end
it
'
does not create
a todo if new assignee is the current user'
do
it
'
creates
a todo if new assignee is the current user'
do
mr_assigned
.
update_attribute
(
:assignee
,
john_doe
)
service
.
reassigned_merge_request
(
mr_assigned
,
john_doe
)
should_
not_create_any_todo
{
service
.
reassigned_merge_request
(
mr_assigned
,
john_doe
)
}
should_
create_todo
(
user:
john_doe
,
target:
mr_assigned
,
author:
john_doe
,
action:
Todo
::
ASSIGNED
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录