Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d4d5ed59
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,发现更多精彩内容 >>
提交
d4d5ed59
编写于
9月 07, 2018
作者:
T
Tim Zallmann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes based on MR discussion around naming, mutations, handling of state
上级
982da16b
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
23 addition
and
24 deletion
+23
-24
app/assets/javascripts/diffs/components/diff_discussions.vue
app/assets/javascripts/diffs/components/diff_discussions.vue
+1
-1
app/assets/javascripts/diffs/components/diff_file.vue
app/assets/javascripts/diffs/components/diff_file.vue
+3
-3
app/assets/javascripts/diffs/components/diff_line_gutter_content.vue
...javascripts/diffs/components/diff_line_gutter_content.vue
+3
-3
app/assets/javascripts/diffs/components/diff_line_note_form.vue
...sets/javascripts/diffs/components/diff_line_note_form.vue
+2
-2
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+7
-11
app/assets/javascripts/diffs/store/modules/diff_state.js
app/assets/javascripts/diffs/store/modules/diff_state.js
+0
-1
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+2
-1
app/assets/javascripts/diffs/store/utils.js
app/assets/javascripts/diffs/store/utils.js
+2
-0
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+1
-1
app/assets/javascripts/notes/stores/utils.js
app/assets/javascripts/notes/stores/utils.js
+1
-1
spec/javascripts/diffs/components/diff_file_spec.js
spec/javascripts/diffs/components/diff_file_spec.js
+1
-0
未找到文件。
app/assets/javascripts/diffs/components/diff_discussions.vue
浏览文件 @
d4d5ed59
...
@@ -40,7 +40,7 @@ export default {
...
@@ -40,7 +40,7 @@ export default {
:render-diff-file=
"false"
:render-diff-file=
"false"
:always-expanded=
"true"
:always-expanded=
"true"
:discussions-by-diff-order=
"true"
:discussions-by-diff-order=
"true"
@
handleNoteDelete
=
"deleteNoteHandler"
@
noteDeleted
=
"deleteNoteHandler"
/>
/>
</ul>
</ul>
</div>
</div>
...
...
app/assets/javascripts/diffs/components/diff_file.vue
浏览文件 @
d4d5ed59
...
@@ -49,7 +49,8 @@ export default {
...
@@ -49,7 +49,8 @@ export default {
!
this
.
isCollapsed
&&
!
this
.
isCollapsed
&&
!
this
.
file
.
highlightedDiffLines
&&
!
this
.
file
.
highlightedDiffLines
&&
!
this
.
isLoadingCollapsedDiff
&&
!
this
.
isLoadingCollapsedDiff
&&
!
this
.
file
.
tooLarge
!
this
.
file
.
tooLarge
&&
this
.
file
.
text
);
);
},
},
showLoadingIcon
()
{
showLoadingIcon
()
{
...
@@ -76,7 +77,6 @@ export default {
...
@@ -76,7 +77,6 @@ export default {
this
.
file
.
collapsed
=
false
;
this
.
file
.
collapsed
=
false
;
this
.
file
.
renderIt
=
true
;
this
.
file
.
renderIt
=
true
;
})
})
.
then
(()
=>
this
.
$nextTick
())
.
then
(()
=>
{
.
then
(()
=>
{
requestIdleCallback
(
requestIdleCallback
(
()
=>
{
()
=>
{
...
@@ -149,7 +149,7 @@ export default {
...
@@ -149,7 +149,7 @@ export default {
class=
"diff-content loading"
class=
"diff-content loading"
/>
/>
<div
<div
v-if=
"showExpandMessage"
v-
else-
if=
"showExpandMessage"
class=
"nothing-here-block diff-collapsed"
class=
"nothing-here-block diff-collapsed"
>
>
{{
__
(
'
This diff is collapsed.
'
)
}}
{{
__
(
'
This diff is collapsed.
'
)
}}
...
...
app/assets/javascripts/diffs/components/diff_line_gutter_content.vue
浏览文件 @
d4d5ed59
...
@@ -73,7 +73,7 @@ export default {
...
@@ -73,7 +73,7 @@ export default {
}),
}),
...
mapGetters
([
'
isLoggedIn
'
]),
...
mapGetters
([
'
isLoggedIn
'
]),
lineHref
()
{
lineHref
()
{
return
this
.
line
&&
this
.
line
.
lineCode
?
`#
${
this
.
line
.
lineCode
}
`
:
'
#
'
;
return
`#
${
this
.
line
.
lineCode
||
''
}
`
;
},
},
shouldShowCommentButton
()
{
shouldShowCommentButton
()
{
return
(
return
(
...
@@ -87,10 +87,10 @@ export default {
...
@@ -87,10 +87,10 @@ export default {
);
);
},
},
hasDiscussions
()
{
hasDiscussions
()
{
return
this
.
line
&&
this
.
line
.
discussions
&&
this
.
line
.
discussions
.
length
>
0
;
return
this
.
line
.
discussions
&&
this
.
line
.
discussions
.
length
>
0
;
},
},
shouldShowAvatarsOnGutter
()
{
shouldShowAvatarsOnGutter
()
{
if
(
this
.
line
&&
!
this
.
line
.
type
&&
this
.
linePosition
===
LINE_POSITION_RIGHT
)
{
if
(
!
this
.
line
.
type
&&
this
.
linePosition
===
LINE_POSITION_RIGHT
)
{
return
false
;
return
false
;
}
}
return
this
.
showCommentButton
&&
this
.
hasDiscussions
;
return
this
.
showCommentButton
&&
this
.
hasDiscussions
;
...
...
app/assets/javascripts/diffs/components/diff_line_note_form.vue
浏览文件 @
d4d5ed59
...
@@ -6,7 +6,7 @@ import noteForm from '../../notes/components/note_form.vue';
...
@@ -6,7 +6,7 @@ import noteForm from '../../notes/components/note_form.vue';
import
{
getNoteFormData
}
from
'
../store/utils
'
;
import
{
getNoteFormData
}
from
'
../store/utils
'
;
import
autosave
from
'
../../notes/mixins/autosave
'
;
import
autosave
from
'
../../notes/mixins/autosave
'
;
import
{
DIFF_NOTE_TYPE
}
from
'
../constants
'
;
import
{
DIFF_NOTE_TYPE
}
from
'
../constants
'
;
import
*
as
utils
from
'
../../notes/stores/utils
'
;
import
{
reduceDiscussionsToLineCodes
}
from
'
../../notes/stores/utils
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -90,7 +90,7 @@ export default {
...
@@ -90,7 +90,7 @@ export default {
this
.
refetchDiscussionById
({
path
:
endpoint
,
discussionId
:
result
.
discussion_id
})
this
.
refetchDiscussionById
({
path
:
endpoint
,
discussionId
:
result
.
discussion_id
})
.
then
(
selectedDiscussion
=>
{
.
then
(
selectedDiscussion
=>
{
const
lineCodeDiscussions
=
utils
.
reduceDiscussionsToLineCodes
([
selectedDiscussion
]);
const
lineCodeDiscussions
=
reduceDiscussionsToLineCodes
([
selectedDiscussion
]);
this
.
assignDiscussionsToDiff
(
lineCodeDiscussions
);
this
.
assignDiscussionsToDiff
(
lineCodeDiscussions
);
this
.
handleCancelCommentForm
();
this
.
handleCancelCommentForm
();
...
...
app/assets/javascripts/diffs/store/actions.js
浏览文件 @
d4d5ed59
...
@@ -29,6 +29,8 @@ export const fetchDiffFiles = ({ state, commit }) => {
...
@@ -29,6 +29,8 @@ export const fetchDiffFiles = ({ state, commit }) => {
.
then
(
handleLocationHash
);
.
then
(
handleLocationHash
);
};
};
// This is adding line discussions to the actual lines in the diff tree
// once for parallel and once for inline mode
export
const
assignDiscussionsToDiff
=
({
state
,
commit
},
allLineDiscussions
)
=>
{
export
const
assignDiscussionsToDiff
=
({
state
,
commit
},
allLineDiscussions
)
=>
{
Object
.
values
(
allLineDiscussions
).
forEach
(
discussions
=>
{
Object
.
values
(
allLineDiscussions
).
forEach
(
discussions
=>
{
if
(
discussions
.
length
>
0
)
{
if
(
discussions
.
length
>
0
)
{
...
@@ -74,12 +76,10 @@ export const removeDiscussionsFromDiff = ({ state, commit }, removeDiscussion) =
...
@@ -74,12 +76,10 @@ export const removeDiscussionsFromDiff = ({ state, commit }, removeDiscussion) =
);
);
if
(
targetLine
)
{
if
(
targetLine
)
{
if
(
targetLine
)
{
if
(
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
removeDiscussion
.
line_code
)
{
if
(
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
removeDiscussion
.
line_code
)
{
commit
(
types
.
REMOVE_LINE_DISCUSSIONS
,
targetLine
.
left
);
commit
(
types
.
REMOVE_LINE_DISCUSSIONS
,
targetLine
.
left
);
}
else
{
}
else
{
commit
(
types
.
REMOVE_LINE_DISCUSSIONS
,
targetLine
.
right
);
commit
(
types
.
REMOVE_LINE_DISCUSSIONS
,
targetLine
.
right
);
}
}
}
}
}
...
@@ -117,11 +117,7 @@ export const startRenderDiffsQueue = ({ state, commit }) => {
...
@@ -117,11 +117,7 @@ export const startRenderDiffsQueue = ({ state, commit }) => {
}
}
});
});
return
new
Promise
(
resolve
=>
{
return
checkItem
();
checkItem
()
.
then
(
resolve
)
.
catch
(()
=>
{});
});
};
};
export
const
setInlineDiffViewType
=
({
commit
})
=>
{
export
const
setInlineDiffViewType
=
({
commit
})
=>
{
...
...
app/assets/javascripts/diffs/store/modules/diff_state.js
浏览文件 @
d4d5ed59
...
@@ -8,7 +8,6 @@ const defaultViewType = INLINE_DIFF_VIEW_TYPE;
...
@@ -8,7 +8,6 @@ const defaultViewType = INLINE_DIFF_VIEW_TYPE;
export
default
()
=>
({
export
default
()
=>
({
isLoading
:
true
,
isLoading
:
true
,
loadingMessage
:
''
,
endpoint
:
''
,
endpoint
:
''
,
basePath
:
''
,
basePath
:
''
,
commit
:
null
,
commit
:
null
,
...
...
app/assets/javascripts/diffs/store/mutations.js
浏览文件 @
d4d5ed59
...
@@ -73,7 +73,8 @@ export default {
...
@@ -73,7 +73,8 @@ export default {
const
normalizedData
=
convertObjectPropsToCamelCase
(
data
,
{
deep
:
true
});
const
normalizedData
=
convertObjectPropsToCamelCase
(
data
,
{
deep
:
true
});
prepareDiffData
(
normalizedData
);
prepareDiffData
(
normalizedData
);
const
[
newFileData
]
=
normalizedData
.
diffFiles
.
filter
(
f
=>
f
.
fileHash
===
file
.
fileHash
);
const
[
newFileData
]
=
normalizedData
.
diffFiles
.
filter
(
f
=>
f
.
fileHash
===
file
.
fileHash
);
Object
.
assign
(
file
,
{
...
newFileData
});
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
fileHash
===
file
.
fileHash
);
Object
.
assign
(
selectedFile
,
{
...
newFileData
});
},
},
[
types
.
EXPAND_ALL_FILES
](
state
)
{
[
types
.
EXPAND_ALL_FILES
](
state
)
{
...
...
app/assets/javascripts/diffs/store/utils.js
浏览文件 @
d4d5ed59
...
@@ -181,6 +181,8 @@ export function trimFirstCharOfLineContent(line = {}) {
...
@@ -181,6 +181,8 @@ export function trimFirstCharOfLineContent(line = {}) {
return
parsedLine
;
return
parsedLine
;
}
}
// This prepares and optimizes the incoming diff data from the server
// by setting up incremental rendering and removing unneeded data
export
function
prepareDiffData
(
diffData
)
{
export
function
prepareDiffData
(
diffData
)
{
const
filesLength
=
diffData
.
diffFiles
.
length
;
const
filesLength
=
diffData
.
diffFiles
.
length
;
let
showingLines
=
0
;
let
showingLines
=
0
;
...
...
app/assets/javascripts/notes/components/noteable_discussion.vue
浏览文件 @
d4d5ed59
...
@@ -266,7 +266,7 @@ Please check your network connection and try again.`;
...
@@ -266,7 +266,7 @@ Please check your network connection and try again.`;
this
.
jumpToDiscussion
(
nextId
);
this
.
jumpToDiscussion
(
nextId
);
},
},
deleteNoteHandler
(
note
)
{
deleteNoteHandler
(
note
)
{
this
.
$emit
(
'
handleNoteDelete
'
,
this
.
discussion
,
note
);
this
.
$emit
(
'
noteDeleted
'
,
this
.
discussion
,
note
);
},
},
},
},
};
};
...
...
app/assets/javascripts/notes/stores/utils.js
浏览文件 @
d4d5ed59
...
@@ -31,7 +31,7 @@ export const reduceDiscussionsToLineCodes = selectedDiscussions =>
...
@@ -31,7 +31,7 @@ export const reduceDiscussionsToLineCodes = selectedDiscussions =>
// For context about line notes: there might be multiple notes with the same line code
// For context about line notes: there might be multiple notes with the same line code
const
items
=
acc
[
note
.
line_code
]
||
[];
const
items
=
acc
[
note
.
line_code
]
||
[];
if
(
note
.
diff_file
)
{
if
(
note
.
diff_file
)
{
Object
.
assign
(
note
,
{
fileHash
:
note
.
diff_file
.
file_hash
});
//
Object.assign(note, { fileHash: note.diff_file.file_hash });
}
}
items
.
push
(
note
);
items
.
push
(
note
);
...
...
spec/javascripts/diffs/components/diff_file_spec.js
浏览文件 @
d4d5ed59
...
@@ -51,6 +51,7 @@ describe('DiffFile', () => {
...
@@ -51,6 +51,7 @@ describe('DiffFile', () => {
});
});
it
(
'
should have collapsed text and link
'
,
done
=>
{
it
(
'
should have collapsed text and link
'
,
done
=>
{
vm
.
file
.
renderIt
=
true
;
vm
.
file
.
collapsed
=
false
;
vm
.
file
.
collapsed
=
false
;
vm
.
file
.
highlightedDiffLines
=
null
;
vm
.
file
.
highlightedDiffLines
=
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录