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
d3cf0c24
Commit
d3cf0c24
authored
Sep 05, 2018
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for Karma, Static Analysis and RSPec for MR Page
parent
c9bacfd6
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
40 deletions
+33
-40
app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js
...vascripts/diff_notes/components/resolve_discussion_btn.js
+1
-1
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+0
-1
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+26
-30
spec/features/merge_request/user_posts_diff_notes_spec.rb
spec/features/merge_request/user_posts_diff_notes_spec.rb
+1
-4
spec/javascripts/diffs/components/diff_file_spec.js
spec/javascripts/diffs/components/diff_file_spec.js
+2
-1
spec/javascripts/diffs/components/diff_line_gutter_content_spec.js
...scripts/diffs/components/diff_line_gutter_content_spec.js
+2
-2
spec/javascripts/diffs/store/mutations_spec.js
spec/javascripts/diffs/store/mutations_spec.js
+1
-1
No files found.
app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js
View file @
d3cf0c24
/* eslint-disable object-shorthand, func-names,
comma-dangle, no-else-return, quotes
*/
/* eslint-disable object-shorthand, func-names,
no-else-return
*/
/* global CommentsStore */
/* global CommentsStore */
/* global ResolveService */
/* global ResolveService */
...
...
app/assets/javascripts/diffs/store/mutations.js
View file @
d3cf0c24
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
_
from
'
underscore
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
import
{
findDiffFile
,
findDiffFile
,
...
...
app/assets/javascripts/notes.js
View file @
d3cf0c24
...
@@ -47,6 +47,7 @@ const REGEX_QUICK_ACTIONS = /^\/\w+.*$/gm;
...
@@ -47,6 +47,7 @@ const REGEX_QUICK_ACTIONS = /^\/\w+.*$/gm;
export
default
class
Notes
{
export
default
class
Notes
{
static
initialize
(
notes_url
,
note_ids
,
last_fetched_at
,
view
,
enableGFM
)
{
static
initialize
(
notes_url
,
note_ids
,
last_fetched_at
,
view
,
enableGFM
)
{
alert
(
'
LALA
'
);
if
(
!
this
.
instance
)
{
if
(
!
this
.
instance
)
{
this
.
instance
=
new
Notes
(
notes_url
,
note_ids
,
last_fetched_at
,
view
,
enableGFM
);
this
.
instance
=
new
Notes
(
notes_url
,
note_ids
,
last_fetched_at
,
view
,
enableGFM
);
}
}
...
@@ -154,7 +155,11 @@ export default class Notes {
...
@@ -154,7 +155,11 @@ export default class Notes {
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.system-note-commit-list-toggler
'
,
this
.
toggleCommitList
);
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.system-note-commit-list-toggler
'
,
this
.
toggleCommitList
);
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.js-toggle-lazy-diff
'
,
this
.
loadLazyDiff
);
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.js-toggle-lazy-diff
'
,
this
.
loadLazyDiff
);
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.js-toggle-lazy-diff-retry-button
'
,
this
.
onClickRetryLazyLoad
.
bind
(
this
));
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.js-toggle-lazy-diff-retry-button
'
,
this
.
onClickRetryLazyLoad
.
bind
(
this
),
);
// fetch notes when tab becomes visible
// fetch notes when tab becomes visible
this
.
$wrapperEl
.
on
(
'
visibilitychange
'
,
this
.
visibilityChange
);
this
.
$wrapperEl
.
on
(
'
visibilitychange
'
,
this
.
visibilityChange
);
...
@@ -252,9 +257,7 @@ export default class Notes {
...
@@ -252,9 +257,7 @@ export default class Notes {
discussionNoteForm
=
$textarea
.
closest
(
'
.js-discussion-note-form
'
);
discussionNoteForm
=
$textarea
.
closest
(
'
.js-discussion-note-form
'
);
if
(
discussionNoteForm
.
length
)
{
if
(
discussionNoteForm
.
length
)
{
if
(
$textarea
.
val
()
!==
''
)
{
if
(
$textarea
.
val
()
!==
''
)
{
if
(
if
(
!
window
.
confirm
(
'
Are you sure you want to cancel creating this comment?
'
))
{
!
window
.
confirm
(
'
Are you sure you want to cancel creating this comment?
'
)
)
{
return
;
return
;
}
}
}
}
...
@@ -266,9 +269,7 @@ export default class Notes {
...
@@ -266,9 +269,7 @@ export default class Notes {
originalText
=
$textarea
.
closest
(
'
form
'
).
data
(
'
originalNote
'
);
originalText
=
$textarea
.
closest
(
'
form
'
).
data
(
'
originalNote
'
);
newText
=
$textarea
.
val
();
newText
=
$textarea
.
val
();
if
(
originalText
!==
newText
)
{
if
(
originalText
!==
newText
)
{
if
(
if
(
!
window
.
confirm
(
'
Are you sure you want to cancel editing this comment?
'
))
{
!
window
.
confirm
(
'
Are you sure you want to cancel editing this comment?
'
)
)
{
return
;
return
;
}
}
}
}
...
@@ -469,6 +470,7 @@ export default class Notes {
...
@@ -469,6 +470,7 @@ export default class Notes {
* Render note in discussion area. To render inline notes use renderDiscussionNote.
* Render note in discussion area. To render inline notes use renderDiscussionNote.
*/
*/
renderDiscussionNote
(
noteEntity
,
$form
)
{
renderDiscussionNote
(
noteEntity
,
$form
)
{
console
.
log
(
'
RENDER DISC NOTE
'
);
var
discussionContainer
,
form
,
row
,
lineType
,
diffAvatarContainer
;
var
discussionContainer
,
form
,
row
,
lineType
,
diffAvatarContainer
;
if
(
!
Notes
.
isNewNote
(
noteEntity
,
this
.
note_ids
))
{
if
(
!
Notes
.
isNewNote
(
noteEntity
,
this
.
note_ids
))
{
...
@@ -1130,6 +1132,7 @@ export default class Notes {
...
@@ -1130,6 +1132,7 @@ export default class Notes {
* Removes the form and if necessary it's temporary row.
* Removes the form and if necessary it's temporary row.
*/
*/
removeDiscussionNoteForm
(
form
)
{
removeDiscussionNoteForm
(
form
)
{
console
.
log
(
'
REM DISC
'
);
var
glForm
,
row
;
var
glForm
,
row
;
row
=
form
.
closest
(
'
tr
'
);
row
=
form
.
closest
(
'
tr
'
);
glForm
=
form
.
data
(
'
glForm
'
);
glForm
=
form
.
data
(
'
glForm
'
);
...
@@ -1316,8 +1319,7 @@ export default class Notes {
...
@@ -1316,8 +1319,7 @@ export default class Notes {
$retryButton
.
prop
(
'
disabled
'
,
true
);
$retryButton
.
prop
(
'
disabled
'
,
true
);
return
this
.
loadLazyDiff
(
e
)
return
this
.
loadLazyDiff
(
e
).
then
(()
=>
{
.
then
(()
=>
{
$retryButton
.
prop
(
'
disabled
'
,
false
);
$retryButton
.
prop
(
'
disabled
'
,
false
);
});
});
}
}
...
@@ -1545,12 +1547,8 @@ export default class Notes {
...
@@ -1545,12 +1547,8 @@ export default class Notes {
<div class="note-header">
<div class="note-header">
<div class="note-header-info">
<div class="note-header-info">
<a href="/
${
_
.
escape
(
currentUsername
)}
">
<a href="/
${
_
.
escape
(
currentUsername
)}
">
<span class="d-none d-sm-inline-block">
${
_
.
escape
(
<span class="d-none d-sm-inline-block">
${
_
.
escape
(
currentUsername
)}
</span>
currentUsername
,
<span class="note-headline-light">
${
_
.
escape
(
currentUsername
)}
</span>
)}
</span>
<span class="note-headline-light">
${
_
.
escape
(
currentUsername
,
)}
</span>
</a>
</a>
</div>
</div>
</div>
</div>
...
@@ -1565,9 +1563,7 @@ export default class Notes {
...
@@ -1565,9 +1563,7 @@ export default class Notes {
);
);
$tempNote
.
find
(
'
.d-none.d-sm-inline-block
'
).
text
(
_
.
escape
(
currentUserFullname
));
$tempNote
.
find
(
'
.d-none.d-sm-inline-block
'
).
text
(
_
.
escape
(
currentUserFullname
));
$tempNote
$tempNote
.
find
(
'
.note-headline-light
'
).
text
(
`@
${
_
.
escape
(
currentUsername
)}
`
);
.
find
(
'
.note-headline-light
'
)
.
text
(
`@
${
_
.
escape
(
currentUsername
)}
`
);
return
$tempNote
;
return
$tempNote
;
}
}
...
...
spec/features/merge_request/user_posts_diff_notes_spec.rb
View file @
d3cf0c24
...
@@ -186,11 +186,8 @@ describe 'Merge request > User posts diff notes', :js do
...
@@ -186,11 +186,8 @@ describe 'Merge request > User posts diff notes', :js do
describe
'posting a note'
do
describe
'posting a note'
do
it
'adds as discussion'
do
it
'adds as discussion'
do
expect
(
page
).
to
have_css
(
'.js-temp-notes-holder'
,
count:
2
)
should_allow_commenting
(
find
(
'[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_22_22"]'
),
asset_form_reset:
false
)
should_allow_commenting
(
find
(
'[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_22_22"]'
),
asset_form_reset:
false
)
expect
(
page
).
to
have_css
(
'.notes_holder .note.note-discussion'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.notes_holder .note.note-discussion'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.js-temp-notes-holder'
,
count:
1
)
expect
(
page
).
to
have_button
(
'Reply...'
)
expect
(
page
).
to
have_button
(
'Reply...'
)
end
end
end
end
...
@@ -281,6 +278,6 @@ describe 'Merge request > User posts diff notes', :js do
...
@@ -281,6 +278,6 @@ describe 'Merge request > User posts diff notes', :js do
end
end
def
assert_form_is_reset
def
assert_form_is_reset
expect
(
page
).
to
have_no_css
(
'.
js-temp-notes-holder
'
)
expect
(
page
).
to
have_no_css
(
'.
note-edit-form
'
)
end
end
end
end
spec/javascripts/diffs/components/diff_file_spec.js
View file @
d3cf0c24
...
@@ -51,7 +51,8 @@ describe('DiffFile', () => {
...
@@ -51,7 +51,8 @@ describe('DiffFile', () => {
});
});
it
(
'
should have collapsed text and link
'
,
done
=>
{
it
(
'
should have collapsed text and link
'
,
done
=>
{
vm
.
file
.
collapsed
=
true
;
vm
.
file
.
collapsed
=
false
;
vm
.
file
.
highlightedDiffLines
=
null
;
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
This diff is collapsed
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
This diff is collapsed
'
);
...
...
spec/javascripts/diffs/components/diff_line_gutter_content_spec.js
View file @
d3cf0c24
...
@@ -11,7 +11,7 @@ describe('DiffLineGutterContent', () => {
...
@@ -11,7 +11,7 @@ describe('DiffLineGutterContent', () => {
const
cmp
=
Vue
.
extend
(
DiffLineGutterContent
);
const
cmp
=
Vue
.
extend
(
DiffLineGutterContent
);
const
props
=
Object
.
assign
({},
options
);
const
props
=
Object
.
assign
({},
options
);
props
.
line
=
{
props
.
line
=
{
c
ode
:
'
LC_42
'
,
lineC
ode
:
'
LC_42
'
,
type
:
'
new
'
,
type
:
'
new
'
,
oldLine
:
null
,
oldLine
:
null
,
newLine
:
1
,
newLine
:
1
,
...
@@ -36,7 +36,7 @@ describe('DiffLineGutterContent', () => {
...
@@ -36,7 +36,7 @@ describe('DiffLineGutterContent', () => {
it
(
'
should return # if there is no lineCode
'
,
()
=>
{
it
(
'
should return # if there is no lineCode
'
,
()
=>
{
const
component
=
createComponent
();
const
component
=
createComponent
();
component
.
line
.
c
ode
=
''
;
component
.
line
.
lineC
ode
=
''
;
expect
(
component
.
lineHref
).
toEqual
(
'
#
'
);
expect
(
component
.
lineHref
).
toEqual
(
'
#
'
);
});
});
});
});
...
...
spec/javascripts/diffs/store/mutations_spec.js
View file @
d3cf0c24
...
@@ -141,7 +141,7 @@ describe('DiffsStoreMutations', () => {
...
@@ -141,7 +141,7 @@ describe('DiffsStoreMutations', () => {
const
file
=
{
fileHash
};
const
file
=
{
fileHash
};
const
data
=
{
diff_files
:
[{
file_hash
:
fileHash
,
extra_field
:
1
,
existingField
:
1
}]
};
const
data
=
{
diff_files
:
[{
file_hash
:
fileHash
,
extra_field
:
1
,
existingField
:
1
}]
};
mutations
[
types
.
ADD_COLLAPSED_DIFFS
](
state
,
{
file
,
data
});
mutations
[
types
.
ADD_COLLAPSED_DIFFS
](
state
,
{
file
:
state
.
diffFiles
[
1
]
,
data
});
expect
(
spy
).
toHaveBeenCalledWith
(
data
,
{
deep
:
true
});
expect
(
spy
).
toHaveBeenCalledWith
(
data
,
{
deep
:
true
});
expect
(
state
.
diffFiles
[
1
].
fileHash
).
toEqual
(
fileHash
);
expect
(
state
.
diffFiles
[
1
].
fileHash
).
toEqual
(
fileHash
);
...
...
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