Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
323596f6
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,发现更多精彩内容 >>
提交
323596f6
编写于
4月 29, 2017
作者:
B
blackst0ne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add system note on description change of issue/merge request
上级
4faa65d8
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
47 addition
and
3 deletion
+47
-3
app/helpers/system_note_helper.rb
app/helpers/system_note_helper.rb
+1
-0
app/models/system_note_metadata.rb
app/models/system_note_metadata.rb
+1
-1
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+8
-0
app/services/system_note_service.rb
app/services/system_note_service.rb
+17
-0
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+1
-1
app/views/projects/merge_requests/show/_mr_box.html.haml
app/views/projects/merge_requests/show/_mr_box.html.haml
+1
-1
changelogs/unreleased/add_system_note_for_editing_issuable.yml
...elogs/unreleased/add_system_note_for_editing_issuable.yml
+4
-0
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+14
-0
未找到文件。
app/helpers/system_note_helper.rb
浏览文件 @
323596f6
module
SystemNoteHelper
ICON_NAMES_BY_ACTION
=
{
'commit'
=>
'icon_commit'
,
'description'
=>
'icon_edit'
,
'merge'
=>
'icon_merge'
,
'merged'
=>
'icon_merged'
,
'opened'
=>
'icon_status_open'
,
...
...
app/models/system_note_metadata.rb
浏览文件 @
323596f6
class
SystemNoteMetadata
<
ActiveRecord
::
Base
ICON_TYPES
=
%w[
commit merge confidential visible label assignee cross_reference
commit
description
merge confidential visible label assignee cross_reference
title time_tracking branch milestone discussion task moved opened closed merged
]
.
freeze
...
...
app/services/issuable_base_service.rb
浏览文件 @
323596f6
...
...
@@ -24,6 +24,10 @@ class IssuableBaseService < BaseService
issuable
,
issuable
.
project
,
current_user
,
old_title
)
end
def
create_description_change_note
(
issuable
)
SystemNoteService
.
change_description
(
issuable
,
issuable
.
project
,
current_user
)
end
def
create_branch_change_note
(
issuable
,
branch_type
,
old_branch
,
new_branch
)
SystemNoteService
.
change_branch
(
issuable
,
issuable
.
project
,
current_user
,
branch_type
,
...
...
@@ -289,6 +293,10 @@ class IssuableBaseService < BaseService
create_title_change_note
(
issuable
,
issuable
.
previous_changes
[
'title'
].
first
)
end
if
issuable
.
previous_changes
.
include?
(
'description'
)
create_description_change_note
(
issuable
)
end
if
issuable
.
previous_changes
.
include?
(
'description'
)
&&
issuable
.
tasks?
create_task_status_note
(
issuable
)
end
...
...
app/services/system_note_service.rb
浏览文件 @
323596f6
...
...
@@ -261,6 +261,23 @@ module SystemNoteService
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'title'
))
end
# Called when the description of a Noteable is changed
#
# noteable - Noteable object that responds to `description`
# project - Project owning noteable
# author - User performing the change
#
# Example Note text:
#
# "changed the description"
#
# Returns the created Note object
def
change_description
(
noteable
,
project
,
author
)
body
=
"changed the description"
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'description'
))
end
# Called when the confidentiality changes
#
# issue - Issue object
...
...
app/views/projects/issues/show.html.haml
浏览文件 @
323596f6
...
...
@@ -61,7 +61,7 @@
=
markdown_field
(
@issue
,
:description
)
%textarea
.hidden.js-task-list-field
=
@issue
.
description
=
edited_time_ago_with_tooltip
(
@issue
,
placement:
'bottom'
,
html_class:
'issue_edited_ago'
)
=
edited_time_ago_with_tooltip
(
@issue
,
placement:
'bottom'
,
html_class:
'issue_edited_ago'
,
include_author:
true
)
#merge-requests
{
data:
{
url:
referenced_merge_requests_namespace_project_issue_url
(
@project
.
namespace
,
@project
,
@issue
)
}
}
// This element is filled in using JavaScript.
...
...
app/views/projects/merge_requests/show/_mr_box.html.haml
浏览文件 @
323596f6
...
...
@@ -10,4 +10,4 @@
%textarea
.hidden.js-task-list-field
=
@merge_request
.
description
=
edited_time_ago_with_tooltip
(
@merge_request
,
placement:
'bottom'
)
=
edited_time_ago_with_tooltip
(
@merge_request
,
placement:
'bottom'
,
include_author:
true
)
changelogs/unreleased/add_system_note_for_editing_issuable.yml
0 → 100644
浏览文件 @
323596f6
---
title
:
Add system note on description change of issue/merge request
merge_request
:
10392
author
:
blackst0ne
spec/services/system_note_service_spec.rb
浏览文件 @
323596f6
...
...
@@ -292,6 +292,20 @@ describe SystemNoteService, services: true do
end
end
describe
'.change_description'
do
subject
{
described_class
.
change_description
(
noteable
,
project
,
author
)
}
context
'when noteable responds to `description`'
do
it_behaves_like
'a system note'
do
let
(
:action
)
{
'description'
}
end
it
'sets the note text'
do
expect
(
subject
.
note
).
to
eq
'changed the description'
end
end
end
describe
'.change_issue_confidentiality'
do
subject
{
described_class
.
change_issue_confidentiality
(
noteable
,
project
,
author
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录