Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
294f0f39
Commit
294f0f39
authored
Mar 04, 2019
by
Phil Hughes
Committed by
Filipa Lacerda
Mar 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CE backport of batch-comments-ee-store-module
parent
86054032
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
70 deletions
+96
-70
app/assets/javascripts/diffs/components/inline_diff_view.vue
app/assets/javascripts/diffs/components/inline_diff_view.vue
+9
-0
app/assets/javascripts/diffs/mixins/draft_comments.js
app/assets/javascripts/diffs/mixins/draft_comments.js
+6
-0
app/assets/javascripts/mr_notes/index.js
app/assets/javascripts/mr_notes/index.js
+3
-66
app/assets/javascripts/mr_notes/init_notes.js
app/assets/javascripts/mr_notes/init_notes.js
+70
-0
spec/javascripts/diffs/components/diff_content_spec.js
spec/javascripts/diffs/components/diff_content_spec.js
+1
-1
spec/javascripts/diffs/components/diff_file_spec.js
spec/javascripts/diffs/components/diff_file_spec.js
+1
-1
spec/javascripts/diffs/components/inline_diff_view_spec.js
spec/javascripts/diffs/components/inline_diff_view_spec.js
+1
-1
spec/javascripts/diffs/components/parallel_diff_view_spec.js
spec/javascripts/diffs/components/parallel_diff_view_spec.js
+5
-1
No files found.
app/assets/javascripts/diffs/components/inline_diff_view.vue
View file @
294f0f39
<
script
>
<
script
>
import
{
mapGetters
}
from
'
vuex
'
;
import
{
mapGetters
}
from
'
vuex
'
;
import
draftCommentsMixin
from
'
ee_else_ce/diffs/mixins/draft_comments
'
;
import
inlineDiffTableRow
from
'
./inline_diff_table_row.vue
'
;
import
inlineDiffTableRow
from
'
./inline_diff_table_row.vue
'
;
import
inlineDiffCommentRow
from
'
./inline_diff_comment_row.vue
'
;
import
inlineDiffCommentRow
from
'
./inline_diff_comment_row.vue
'
;
...
@@ -7,7 +8,10 @@ export default {
...
@@ -7,7 +8,10 @@ export default {
components
:
{
components
:
{
inlineDiffCommentRow
,
inlineDiffCommentRow
,
inlineDiffTableRow
,
inlineDiffTableRow
,
InlineDraftCommentRow
:
()
=>
import
(
'
ee_component/batch_comments/components/inline_draft_comment_row.vue
'
),
},
},
mixins
:
[
draftCommentsMixin
],
props
:
{
props
:
{
diffFile
:
{
diffFile
:
{
type
:
Object
,
type
:
Object
,
...
@@ -54,6 +58,11 @@ export default {
...
@@ -54,6 +58,11 @@ export default {
:line="line"
:line="line"
:help-page-path="helpPagePath"
:help-page-path="helpPagePath"
/>
/>
<inline-draft-comment-row
v-if=
"shouldRenderDraftRow(diffFile.file_hash, line)"
:key=
"`draft_$
{index}`"
:draft="draftForLine(diffFile.file_hash, line)"
/>
</
template
>
</
template
>
</tbody>
</tbody>
</table>
</table>
...
...
app/assets/javascripts/diffs/mixins/draft_comments.js
0 → 100644
View file @
294f0f39
export
default
{
computed
:
{
shouldRenderDraftRow
:
()
=>
()
=>
false
,
draftForLine
:
()
=>
()
=>
({}),
},
};
app/assets/javascripts/mr_notes/index.js
View file @
294f0f39
import
$
from
'
jquery
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
store
from
'
ee_else_ce/mr_notes/stores
'
;
import
initNotesApp
from
'
./init_notes
'
;
import
initDiffsApp
from
'
../diffs
'
;
import
initDiffsApp
from
'
../diffs
'
;
import
notesApp
from
'
../notes/components/notes_app.vue
'
;
import
discussionCounter
from
'
../notes/components/discussion_counter.vue
'
;
import
discussionCounter
from
'
../notes/components/discussion_counter.vue
'
;
import
initDiscussionFilters
from
'
../notes/discussion_filters
'
;
import
initDiscussionFilters
from
'
../notes/discussion_filters
'
;
import
store
from
'
./stores
'
;
import
MergeRequest
from
'
../merge_request
'
;
import
MergeRequest
from
'
../merge_request
'
;
import
{
resetServiceWorkersPublicPath
}
from
'
../lib/utils/webpack
'
;
import
{
resetServiceWorkersPublicPath
}
from
'
../lib/utils/webpack
'
;
...
@@ -18,68 +16,7 @@ export default function initMrNotes() {
...
@@ -18,68 +16,7 @@ export default function initMrNotes() {
action
:
mrShowNode
.
dataset
.
mrAction
,
action
:
mrShowNode
.
dataset
.
mrAction
,
});
});
// eslint-disable-next-line no-new
initNotesApp
();
new
Vue
({
el
:
'
#js-vue-mr-discussions
'
,
name
:
'
MergeRequestDiscussions
'
,
components
:
{
notesApp
,
},
store
,
data
()
{
const
notesDataset
=
document
.
getElementById
(
'
js-vue-mr-discussions
'
).
dataset
;
const
noteableData
=
JSON
.
parse
(
notesDataset
.
noteableData
);
noteableData
.
noteableType
=
notesDataset
.
noteableType
;
noteableData
.
targetType
=
notesDataset
.
targetType
;
return
{
noteableData
,
currentUserData
:
JSON
.
parse
(
notesDataset
.
currentUserData
),
notesData
:
JSON
.
parse
(
notesDataset
.
notesData
),
helpPagePath
:
notesDataset
.
helpPagePath
,
};
},
computed
:
{
...
mapGetters
([
'
discussionTabCounter
'
]),
...
mapState
({
activeTab
:
state
=>
state
.
page
.
activeTab
,
}),
},
watch
:
{
discussionTabCounter
()
{
this
.
updateDiscussionTabCounter
();
},
},
created
()
{
this
.
setActiveTab
(
window
.
mrTabs
.
getCurrentAction
());
},
mounted
()
{
this
.
notesCountBadge
=
$
(
'
.issuable-details
'
).
find
(
'
.notes-tab .badge
'
);
$
(
document
).
on
(
'
visibilitychange
'
,
this
.
updateDiscussionTabCounter
);
window
.
mrTabs
.
eventHub
.
$on
(
'
MergeRequestTabChange
'
,
this
.
setActiveTab
);
},
beforeDestroy
()
{
$
(
document
).
off
(
'
visibilitychange
'
,
this
.
updateDiscussionTabCounter
);
window
.
mrTabs
.
eventHub
.
$off
(
'
MergeRequestTabChange
'
,
this
.
setActiveTab
);
},
methods
:
{
...
mapActions
([
'
setActiveTab
'
]),
updateDiscussionTabCounter
()
{
this
.
notesCountBadge
.
text
(
this
.
discussionTabCounter
);
},
},
render
(
createElement
)
{
return
createElement
(
'
notes-app
'
,
{
props
:
{
noteableData
:
this
.
noteableData
,
notesData
:
this
.
notesData
,
userData
:
this
.
currentUserData
,
shouldShow
:
this
.
activeTab
===
'
show
'
,
helpPagePath
:
this
.
helpPagePath
,
},
});
},
});
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
new
Vue
({
new
Vue
({
...
...
app/assets/javascripts/mr_notes/init_notes.js
0 → 100644
View file @
294f0f39
import
$
from
'
jquery
'
;
import
Vue
from
'
vue
'
;
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
store
from
'
ee_else_ce/mr_notes/stores
'
;
import
notesApp
from
'
../notes/components/notes_app.vue
'
;
export
default
()
=>
{
// eslint-disable-next-line no-new
new
Vue
({
el
:
'
#js-vue-mr-discussions
'
,
name
:
'
MergeRequestDiscussions
'
,
components
:
{
notesApp
,
},
store
,
data
()
{
const
notesDataset
=
document
.
getElementById
(
'
js-vue-mr-discussions
'
).
dataset
;
const
noteableData
=
JSON
.
parse
(
notesDataset
.
noteableData
);
noteableData
.
noteableType
=
notesDataset
.
noteableType
;
noteableData
.
targetType
=
notesDataset
.
targetType
;
return
{
noteableData
,
currentUserData
:
JSON
.
parse
(
notesDataset
.
currentUserData
),
notesData
:
JSON
.
parse
(
notesDataset
.
notesData
),
helpPagePath
:
notesDataset
.
helpPagePath
,
};
},
computed
:
{
...
mapGetters
([
'
discussionTabCounter
'
]),
...
mapState
({
activeTab
:
state
=>
state
.
page
.
activeTab
,
}),
},
watch
:
{
discussionTabCounter
()
{
this
.
updateDiscussionTabCounter
();
},
},
created
()
{
this
.
setActiveTab
(
window
.
mrTabs
.
getCurrentAction
());
},
mounted
()
{
this
.
notesCountBadge
=
$
(
'
.issuable-details
'
).
find
(
'
.notes-tab .badge
'
);
$
(
document
).
on
(
'
visibilitychange
'
,
this
.
updateDiscussionTabCounter
);
window
.
mrTabs
.
eventHub
.
$on
(
'
MergeRequestTabChange
'
,
this
.
setActiveTab
);
},
beforeDestroy
()
{
$
(
document
).
off
(
'
visibilitychange
'
,
this
.
updateDiscussionTabCounter
);
window
.
mrTabs
.
eventHub
.
$off
(
'
MergeRequestTabChange
'
,
this
.
setActiveTab
);
},
methods
:
{
...
mapActions
([
'
setActiveTab
'
]),
updateDiscussionTabCounter
()
{
this
.
notesCountBadge
.
text
(
this
.
discussionTabCounter
);
},
},
render
(
createElement
)
{
return
createElement
(
'
notes-app
'
,
{
props
:
{
noteableData
:
this
.
noteableData
,
notesData
:
this
.
notesData
,
userData
:
this
.
currentUserData
,
shouldShow
:
this
.
activeTab
===
'
show
'
,
helpPagePath
:
this
.
helpPagePath
,
},
});
},
});
};
spec/javascripts/diffs/components/diff_content_spec.js
View file @
294f0f39
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
DiffContentComponent
from
'
~/diffs/components/diff_content.vue
'
;
import
DiffContentComponent
from
'
~/diffs/components/diff_content.vue
'
;
import
{
createStore
}
from
'
~
/mr_notes/stores
'
;
import
{
createStore
}
from
'
ee_else_ce
/mr_notes/stores
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
GREEN_BOX_IMAGE_URL
,
RED_BOX_IMAGE_URL
}
from
'
spec/test_constants
'
;
import
{
GREEN_BOX_IMAGE_URL
,
RED_BOX_IMAGE_URL
}
from
'
spec/test_constants
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
...
...
spec/javascripts/diffs/components/diff_file_spec.js
View file @
294f0f39
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
DiffFileComponent
from
'
~/diffs/components/diff_file.vue
'
;
import
DiffFileComponent
from
'
~/diffs/components/diff_file.vue
'
;
import
{
diffViewerModes
,
diffViewerErrors
}
from
'
~/ide/constants
'
;
import
{
diffViewerModes
,
diffViewerErrors
}
from
'
~/ide/constants
'
;
import
store
from
'
~
/mr_notes/stores
'
;
import
store
from
'
ee_else_ce
/mr_notes/stores
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
diffFileMockData
from
'
../mock_data/diff_file
'
;
import
diffFileMockData
from
'
../mock_data/diff_file
'
;
...
...
spec/javascripts/diffs/components/inline_diff_view_spec.js
View file @
294f0f39
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
InlineDiffView
from
'
~/diffs/components/inline_diff_view.vue
'
;
import
InlineDiffView
from
'
~/diffs/components/inline_diff_view.vue
'
;
import
store
from
'
~
/mr_notes/stores
'
;
import
store
from
'
ee_else_ce
/mr_notes/stores
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
diffFileMockData
from
'
../mock_data/diff_file
'
;
import
diffFileMockData
from
'
../mock_data/diff_file
'
;
import
discussionsMockData
from
'
../mock_data/diff_discussions
'
;
import
discussionsMockData
from
'
../mock_data/diff_discussions
'
;
...
...
spec/javascripts/diffs/components/parallel_diff_view_spec.js
View file @
294f0f39
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
ParallelDiffView
from
'
~/diffs/components/parallel_diff_view.vue
'
;
import
ParallelDiffView
from
'
~/diffs/components/parallel_diff_view.vue
'
;
import
store
from
'
~
/mr_notes/stores
'
;
import
store
from
'
ee_else_ce
/mr_notes/stores
'
;
import
*
as
constants
from
'
~/diffs/constants
'
;
import
*
as
constants
from
'
~/diffs/constants
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
diffFileMockData
from
'
../mock_data/diff_file
'
;
import
diffFileMockData
from
'
../mock_data/diff_file
'
;
...
@@ -18,6 +18,10 @@ describe('ParallelDiffView', () => {
...
@@ -18,6 +18,10 @@ describe('ParallelDiffView', () => {
}).
$mount
();
}).
$mount
();
});
});
afterEach
(()
=>
{
component
.
$destroy
();
});
describe
(
'
assigned
'
,
()
=>
{
describe
(
'
assigned
'
,
()
=>
{
describe
(
'
diffLines
'
,
()
=>
{
describe
(
'
diffLines
'
,
()
=>
{
it
(
'
should normalize lines for empty cells
'
,
()
=>
{
it
(
'
should normalize lines for empty cells
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment