Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
32737672
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,发现更多精彩内容 >>
提交
32737672
编写于
7月 31, 2018
作者:
A
André Luís
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Merge branch 'tz-mr-refactor-mem-posting' into 'master'"
This reverts commit
9c121352
, reversing changes made to
c1b335e0
.
上级
02e35a0d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
8 deletion
+21
-8
app/assets/javascripts/lib/utils/poll.js
app/assets/javascripts/lib/utils/poll.js
+0
-1
app/assets/javascripts/notes/stores/mutations.js
app/assets/javascripts/notes/stores/mutations.js
+15
-4
app/assets/javascripts/notes/stores/utils.js
app/assets/javascripts/notes/stores/utils.js
+6
-3
未找到文件。
app/assets/javascripts/lib/utils/poll.js
浏览文件 @
32737672
...
...
@@ -63,7 +63,6 @@ export default class Poll {
const
headers
=
normalizeHeaders
(
response
.
headers
);
const
pollInterval
=
parseInt
(
headers
[
this
.
intervalHeader
],
10
);
if
(
pollInterval
>
0
&&
successCodes
.
indexOf
(
response
.
status
)
!==
-
1
&&
this
.
canPoll
)
{
clearTimeout
(
this
.
timeoutID
);
this
.
timeoutID
=
setTimeout
(()
=>
{
this
.
makeRequest
();
},
pollInterval
);
...
...
app/assets/javascripts/notes/stores/mutations.js
浏览文件 @
32737672
...
...
@@ -174,19 +174,27 @@ export default {
[
types
.
UPDATE_NOTE
](
state
,
note
)
{
const
noteObj
=
utils
.
findNoteObjectById
(
state
.
discussions
,
note
.
discussion_id
);
if
(
noteObj
.
individual_note
)
{
noteObj
.
notes
.
splice
(
0
,
1
,
note
);
}
else
{
const
comment
=
utils
.
findNoteObjectById
(
noteObj
.
notes
,
note
.
id
);
Object
.
assign
(
comment
,
note
);
noteObj
.
notes
.
splice
(
noteObj
.
notes
.
indexOf
(
comment
),
1
,
note
);
}
},
[
types
.
UPDATE_DISCUSSION
](
state
,
noteData
)
{
const
note
=
noteData
;
const
selectedDiscussion
=
state
.
discussions
.
find
(
n
=>
n
.
id
===
note
.
id
);
let
index
=
0
;
state
.
discussions
.
forEach
((
n
,
i
)
=>
{
if
(
n
.
id
===
note
.
id
)
{
index
=
i
;
}
});
note
.
expanded
=
true
;
// override expand flag to prevent collapse
Object
.
assign
(
selectedDiscussion
,
note
);
state
.
discussions
.
splice
(
index
,
1
,
note
);
},
[
types
.
CLOSE_ISSUE
](
state
)
{
...
...
@@ -207,9 +215,12 @@ export default {
[
types
.
SET_DISCUSSION_DIFF_LINES
](
state
,
{
discussionId
,
diffLines
})
{
const
discussion
=
utils
.
findNoteObjectById
(
state
.
discussions
,
discussionId
);
const
index
=
state
.
discussions
.
indexOf
(
discussion
);
Object
.
assign
(
discussion
,
{
const
discussionWithDiffLines
=
Object
.
assign
({},
discussion
,
{
truncated_diff_lines
:
diffLines
,
});
state
.
discussions
.
splice
(
index
,
1
,
discussionWithDiffLines
);
},
};
app/assets/javascripts/notes/stores/utils.js
浏览文件 @
32737672
...
...
@@ -2,11 +2,13 @@ import AjaxCache from '~/lib/utils/ajax_cache';
const
REGEX_QUICK_ACTIONS
=
/^
\/\w
+.*$/gm
;
export
const
findNoteObjectById
=
(
notes
,
id
)
=>
notes
.
find
(
n
=>
n
.
id
===
id
);
export
const
findNoteObjectById
=
(
notes
,
id
)
=>
notes
.
filter
(
n
=>
n
.
id
===
id
)[
0
];
export
const
getQuickActionText
=
note
=>
{
let
text
=
'
Applying command
'
;
const
quickActions
=
AjaxCache
.
get
(
gl
.
GfmAutoComplete
.
dataSources
.
commands
)
||
[];
const
quickActions
=
AjaxCache
.
get
(
gl
.
GfmAutoComplete
.
dataSources
.
commands
)
||
[];
const
executedCommands
=
quickActions
.
filter
(
command
=>
{
const
commandRegex
=
new
RegExp
(
`/
${
command
.
name
}
`
);
...
...
@@ -27,4 +29,5 @@ export const getQuickActionText = note => {
export
const
hasQuickActions
=
note
=>
REGEX_QUICK_ACTIONS
.
test
(
note
);
export
const
stripQuickActions
=
note
=>
note
.
replace
(
REGEX_QUICK_ACTIONS
,
''
).
trim
();
export
const
stripQuickActions
=
note
=>
note
.
replace
(
REGEX_QUICK_ACTIONS
,
''
).
trim
();
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录