Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
17d67a98
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,发现更多精彩内容 >>
提交
17d67a98
编写于
6月 29, 2017
作者:
F
Fatih Acet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
IssueNotesRefactor: Implement close/reopen issue actions.
上级
d24e47a9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
52 addition
and
30 deletion
+52
-30
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+45
-24
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+2
-1
app/assets/javascripts/notes/components/issue_note_awards_list.vue
...s/javascripts/notes/components/issue_note_awards_list.vue
+1
-1
app/assets/javascripts/notes/services/issue_notes_service.js
app/assets/javascripts/notes/services/issue_notes_service.js
+1
-1
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+1
-1
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+2
-2
未找到文件。
app/assets/javascripts/notes/components/issue_comment_form.vue
浏览文件 @
17d67a98
...
...
@@ -28,43 +28,63 @@ export default {
commentButtonTitle
()
{
return
this
.
noteType
===
'
comment
'
?
'
Comment
'
:
'
Start discussion
'
;
},
isIssueOpen
()
{
return
this
.
issueState
===
'
opened
'
||
this
.
issueState
===
'
reopened
'
;
},
issueActionButtonTitle
()
{
if
(
this
.
note
.
length
)
{
const
actionText
=
this
.
is
sueState
===
'
open
'
?
'
close
'
:
'
reopen
'
;
const
actionText
=
this
.
is
IssueOpen
?
'
close
'
:
'
reopen
'
;
return
this
.
noteType
===
'
comment
'
?
`Comment &
${
actionText
}
issue`
:
`Start discussion &
${
actionText
}
issue`
;
}
return
this
.
is
sueState
===
'
open
'
?
'
Close issue
'
:
'
Reopen issue
'
;
return
this
.
is
IssueOpen
?
'
Close issue
'
:
'
Reopen issue
'
;
},
},
methods
:
{
handleSave
()
{
const
data
=
{
endpoint
:
this
.
endpoint
,
noteData
:
{
full_data
:
true
,
note
:
{
noteable_type
:
'
Issue
'
,
noteable_id
:
window
.
gl
.
issueData
.
id
,
note
:
this
.
note
,
}
},
};
handleSave
(
withIssueAction
)
{
if
(
this
.
note
.
length
)
{
const
data
=
{
endpoint
:
this
.
endpoint
,
noteData
:
{
full_data
:
true
,
note
:
{
noteable_type
:
'
Issue
'
,
noteable_id
:
window
.
gl
.
issueData
.
id
,
note
:
this
.
note
,
},
},
};
if
(
this
.
noteType
===
'
discussion
'
)
{
data
.
noteData
.
note
.
type
=
'
DiscussionNote
'
;
if
(
this
.
noteType
===
'
discussion
'
)
{
data
.
noteData
.
note
.
type
=
'
DiscussionNote
'
;
}
this
.
$store
.
dispatch
(
'
createNewNote
'
,
data
)
.
then
((
res
)
=>
{
if
(
res
.
errors
)
{
this
.
handleError
();
}
else
{
this
.
discard
();
}
})
.
catch
(
this
.
handleError
);
}
this
.
$store
.
dispatch
(
'
createNewNote
'
,
data
)
.
then
((
res
)
=>
{
if
(
res
.
errors
)
{
return
this
.
handleError
();
}
if
(
withIssueAction
)
{
if
(
this
.
isIssueOpen
)
{
gl
.
issueData
.
state
=
'
closed
'
;
this
.
issueState
=
'
closed
'
;
}
else
{
gl
.
issueData
.
state
=
'
reopened
'
;
this
.
issueState
=
'
reopened
'
;
}
this
.
isIssueOpen
=
!
this
.
isIssueOpen
;
this
.
discard
();
})
.
catch
(
this
.
handleError
);
// This is out of scope for the Notes Vue component.
// It was the shortest path to update the issue state and relevant places.
$
(
'
.js-btn-issue-action:visible
'
).
trigger
(
'
click
'
);
}
},
discard
()
{
this
.
note
=
''
;
...
...
@@ -171,6 +191,7 @@ export default {
</ul>
</div>
<a
@
click=
"handleSave(true)"
:class=
"
{'btn-reopen': issueState === 'closed', 'btn-close': issueState === 'open'}"
class="btn btn-nr btn-comment">
{{
issueActionButtonTitle
}}
...
...
app/assets/javascripts/notes/components/issue_note.vue
浏览文件 @
17d67a98
...
...
@@ -59,8 +59,9 @@ export default {
},
formUpdateHandler
(
note
)
{
const
data
=
{
endpoint
:
`
${
this
.
note
.
path
}
?full_data=1`
,
endpoint
:
this
.
note
.
path
,
note
:
{
full_data
:
true
,
target_type
:
'
issue
'
,
target_id
:
this
.
note
.
noteable_id
,
note
,
...
...
app/assets/javascripts/notes/components/issue_note_awards_list.vue
浏览文件 @
17d67a98
<
script
>
import
*
as
Emoji
from
'
../../emoji
'
;
import
emojiSmiling
from
'
icons/_emoji_slightly_smiling_face.svg
'
;
import
emojiSmile
from
'
icons/_emoji_smile.svg
'
;
import
emojiSmiley
from
'
icons/_emoji_smiley.svg
'
;
import
*
as
Emoji
from
'
../../emoji
'
;
export
default
{
props
:
{
...
...
app/assets/javascripts/notes/services/issue_notes_service.js
浏览文件 @
17d67a98
...
...
@@ -18,5 +18,5 @@ export default {
},
createNewNote
(
endpoint
,
data
)
{
return
Vue
.
http
.
post
(
endpoint
,
data
,
{
emulateJSON
:
true
});
}
}
,
};
app/assets/javascripts/notes/stores/issue_notes_store.js
浏览文件 @
17d67a98
...
...
@@ -58,7 +58,7 @@ const mutations = {
expanded
:
true
,
id
:
discussion_id
,
individual_note
:
!
(
type
===
'
DiscussionNote
'
),
notes
:
[
note
],
notes
:
[
note
],
reply_id
:
discussion_id
,
};
...
...
app/views/projects/issues/show.html.haml
浏览文件 @
17d67a98
...
...
@@ -34,8 +34,8 @@
-
unless
current_user
==
@issue
.
author
%li
=
link_to
'Report abuse'
,
new_abuse_report_path
(
user_id:
@issue
.
author
.
id
,
ref_url:
issue_url
(
@issue
))
-
if
can_update_issue
%li
=
link_to
'Close issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
format:
'json'
),
class:
"btn-close
#{
issue_button_visibility
(
@issue
,
true
)
}
"
,
title:
'Close issue'
%li
=
link_to
'Reopen issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :reopen
},
format:
'json'
),
class:
"btn-reopen
#{
issue_button_visibility
(
@issue
,
false
)
}
"
,
title:
'Reopen issue'
%li
=
link_to
'Close issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
format:
'json'
),
class:
"btn-close
js-btn-issue-action
#{
issue_button_visibility
(
@issue
,
true
)
}
"
,
title:
'Close issue'
%li
=
link_to
'Reopen issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :reopen
},
format:
'json'
),
class:
"btn-reopen
js-btn-issue-action
#{
issue_button_visibility
(
@issue
,
false
)
}
"
,
title:
'Reopen issue'
-
if
can_report_spam
%li
=
link_to
'Submit as spam'
,
mark_as_spam_project_issue_path
(
@project
,
@issue
),
method: :post
,
class:
'btn-spam'
,
title:
'Submit as spam'
-
if
can_update_issue
||
can_report_spam
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录