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
Jérome Perrin
gitlab-ce
Commits
d80f9036
Commit
d80f9036
authored
Apr 07, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix creating discussion when diff view is set to parallel
parent
2a771d57
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
27 deletions
+20
-27
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+19
-27
app/assets/javascripts/render_gfm.js
app/assets/javascripts/render_gfm.js
+1
-0
No files found.
app/assets/javascripts/notes.js
View file @
d80f9036
...
@@ -338,7 +338,7 @@ require('./task_list');
...
@@ -338,7 +338,7 @@ require('./task_list');
*/
*/
Notes
.
prototype
.
renderDiscussionNote
=
function
(
note
,
$form
)
{
Notes
.
prototype
.
renderDiscussionNote
=
function
(
note
,
$form
)
{
var
discussionContainer
,
form
,
note_html
,
row
,
lineType
,
diffAvatarContainer
;
var
discussionContainer
,
form
,
row
,
lineType
,
diffAvatarContainer
;
if
(
!
this
.
isNewNote
(
note
))
{
if
(
!
this
.
isNewNote
(
note
))
{
return
;
return
;
}
}
...
@@ -347,45 +347,37 @@ require('./task_list');
...
@@ -347,45 +347,37 @@ require('./task_list');
row
=
form
.
closest
(
"
tr
"
);
row
=
form
.
closest
(
"
tr
"
);
lineType
=
this
.
isParallelView
()
?
form
.
find
(
'
#line_type
'
).
val
()
:
'
old
'
;
lineType
=
this
.
isParallelView
()
?
form
.
find
(
'
#line_type
'
).
val
()
:
'
old
'
;
diffAvatarContainer
=
row
.
prevAll
(
'
.line_holder
'
).
first
().
find
(
'
.js-avatar-container.
'
+
lineType
+
'
_line
'
);
diffAvatarContainer
=
row
.
prevAll
(
'
.line_holder
'
).
first
().
find
(
'
.js-avatar-container.
'
+
lineType
+
'
_line
'
);
note_html
=
$
(
note
.
html
);
note_html
.
renderGFM
();
// is this the first note of discussion?
// is this the first note of discussion?
discussionContainer
=
$
(
"
.notes[data-discussion-id='
"
+
note
.
discussion_id
+
"
']
"
);
discussionContainer
=
$
(
"
.notes[data-discussion-id='
"
+
note
.
discussion_id
+
"
']
"
);
if
(
!
discussionContainer
.
length
)
{
if
(
!
discussionContainer
.
length
)
{
discussionContainer
=
form
.
closest
(
'
.discussion
'
).
find
(
'
.notes
'
);
discussionContainer
=
form
.
closest
(
'
.discussion
'
).
find
(
'
.notes
'
);
}
}
if
(
discussionContainer
.
length
===
0
)
{
if
(
discussionContainer
.
length
===
0
)
{
if
(
note
.
diff_discussion_html
)
{
var
$discussion
=
$
(
note
.
diff_discussion_html
).
renderGFM
();
if
(
!
this
.
isParallelView
()
||
row
.
hasClass
(
'
js-temp-notes-holder
'
))
{
if
(
!
this
.
isParallelView
()
||
row
.
hasClass
(
'
js-temp-notes-holder
'
))
{
// insert the note and the reply button after the temp row
// insert the note and the reply button after the temp row
row
.
after
(
note
.
diff_discussion_html
);
row
.
after
(
$discussion
);
// remove the note (will be added again below)
row
.
next
().
find
(
"
.note
"
).
remove
();
}
else
{
}
else
{
// Merge new discussion HTML in
// Merge new discussion HTML in
var
$discussion
=
$
(
note
.
diff_discussion_html
);
var
$notes
=
$discussion
.
find
(
'
.notes[data-discussion-id="
'
+
note
.
discussion_id
+
'
"]
'
);
var
$notes
=
$discussion
.
find
(
'
.notes[data-discussion-id="
'
+
note
.
discussion_id
+
'
"]
'
);
var
contentContainerClass
=
'
.
'
+
$notes
.
closest
(
'
.notes_content
'
)
var
contentContainerClass
=
'
.
'
+
$notes
.
closest
(
'
.notes_content
'
)
.
attr
(
'
class
'
)
.
attr
(
'
class
'
)
.
split
(
'
'
)
.
split
(
'
'
)
.
join
(
'
.
'
);
.
join
(
'
.
'
);
// remove the note (will be added again below)
$notes
.
find
(
'
.note
'
).
remove
();
row
.
find
(
contentContainerClass
+
'
.content
'
).
append
(
$notes
.
closest
(
'
.content
'
).
children
());
row
.
find
(
contentContainerClass
+
'
.content
'
).
append
(
$notes
.
closest
(
'
.content
'
).
children
());
}
}
// Before that, the container didn't exist
}
discussionContainer
=
$
(
"
.notes[data-discussion-id='
"
+
note
.
discussion_id
+
"
']
"
);
// Add note to 'Changes' page discussions
discussionContainer
.
append
(
note_html
);
// Init discussion on 'Discussion' page if it is merge request page
// Init discussion on 'Discussion' page if it is merge request page
if
(
$
(
'
body
'
).
attr
(
'
data-page
'
).
indexOf
(
'
projects:merge_request
'
)
===
0
||
!
note
.
diff_discussion_html
)
{
if
(
$
(
'
body
'
).
attr
(
'
data-page
'
).
indexOf
(
'
projects:merge_request
'
)
===
0
||
!
note
.
diff_discussion_html
)
{
$
(
'
ul.main-notes-list
'
).
append
(
note
.
discussion_html
).
renderGFM
(
);
$
(
'
ul.main-notes-list
'
).
append
(
$
(
note
.
discussion_html
).
renderGFM
()
);
}
}
}
else
{
}
else
{
// append new note to all matching discussions
// append new note to all matching discussions
discussionContainer
.
append
(
note_html
);
discussionContainer
.
append
(
$
(
note
.
html
).
renderGFM
()
);
}
}
if
(
typeof
gl
.
diffNotesCompileComponents
!==
'
undefined
'
&&
note
.
discussion_resolvable
)
{
if
(
typeof
gl
.
diffNotesCompileComponents
!==
'
undefined
'
&&
note
.
discussion_resolvable
)
{
...
...
app/assets/javascripts/render_gfm.js
View file @
d80f9036
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
$
.
fn
.
renderGFM
=
function
()
{
$
.
fn
.
renderGFM
=
function
()
{
this
.
find
(
'
.js-syntax-highlight
'
).
syntaxHighlight
();
this
.
find
(
'
.js-syntax-highlight
'
).
syntaxHighlight
();
this
.
find
(
'
.js-render-math
'
).
renderMath
();
this
.
find
(
'
.js-render-math
'
).
renderMath
();
return
this
;
};
};
$
(
document
).
on
(
'
ready load
'
,
function
()
{
$
(
document
).
on
(
'
ready load
'
,
function
()
{
...
...
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