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
Tatuya Kamada
gitlab-ce
Commits
6d9715d8
Commit
6d9715d8
authored
Jul 28, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show existing discussion when adding new comment on line with a hidden resolved discussion
parent
ce1843b7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
49 deletions
+47
-49
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+6
-1
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+11
-6
app/models/note.rb
app/models/note.rb
+0
-1
app/views/discussions/_diff_discussion.html.haml
app/views/discussions/_diff_discussion.html.haml
+4
-11
app/views/discussions/_diff_with_notes.html.haml
app/views/discussions/_diff_with_notes.html.haml
+1
-1
app/views/discussions/_discussion.html.haml
app/views/discussions/_discussion.html.haml
+2
-1
app/views/discussions/_notes.html.haml
app/views/discussions/_notes.html.haml
+13
-5
app/views/discussions/_parallel_diff_discussion.html.haml
app/views/discussions/_parallel_diff_discussion.html.haml
+10
-23
No files found.
app/assets/javascripts/application.js
View file @
6d9715d8
...
@@ -224,7 +224,12 @@
...
@@ -224,7 +224,12 @@
});
});
$body
.
on
(
"
click
"
,
"
.js-toggle-diff-comments
"
,
function
(
e
)
{
$body
.
on
(
"
click
"
,
"
.js-toggle-diff-comments
"
,
function
(
e
)
{
$
(
this
).
toggleClass
(
'
active
'
);
$
(
this
).
toggleClass
(
'
active
'
);
$
(
this
).
closest
(
"
.diff-file
"
).
find
(
"
.notes_holder
"
).
toggle
();
var
notesHolders
=
$
(
this
).
closest
(
"
.diff-file
"
).
find
(
"
.notes_holder
"
);
if
(
$
(
this
).
hasClass
(
'
active
'
))
{
notesHolders
.
show
();
}
else
{
notesHolders
.
hide
();
}
return
e
.
preventDefault
();
return
e
.
preventDefault
();
});
});
$document
.
off
(
"
click
"
,
'
.js-confirm-danger
'
);
$document
.
off
(
"
click
"
,
'
.js-confirm-danger
'
);
...
...
app/assets/javascripts/notes.js
View file @
6d9715d8
...
@@ -637,16 +637,19 @@
...
@@ -637,16 +637,19 @@
nextRow
=
row
.
next
();
nextRow
=
row
.
next
();
hasNotes
=
nextRow
.
is
(
"
.notes_holder
"
);
hasNotes
=
nextRow
.
is
(
"
.notes_holder
"
);
addForm
=
false
;
addForm
=
false
;
targetContent
=
"
.notes_content
"
;
notesContentSelector
=
"
.notes_content
"
;
rowCssToAdd
=
"
<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
\"
colspan=
\"
2
\"
></td><td class=
\"
notes_content
\"
></td></tr>
"
;
rowCssToAdd
=
"
<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
\"
colspan=
\"
2
\"
></td><td class=
\"
notes_content
\"
><
div class=
\"
content
\"
></div><
/td></tr>
"
;
if
(
this
.
isParallelView
())
{
if
(
this
.
isParallelView
())
{
lineType
=
$link
.
data
(
"
lineType
"
);
lineType
=
$link
.
data
(
"
lineType
"
);
targetContent
+=
"
.
"
+
lineType
;
notesContentSelector
+=
"
.
"
+
lineType
;
rowCssToAdd
=
"
<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
\"
></td><td class=
\"
notes_content parallel old
\"
></td><td class=
\"
notes_line
\"
></td><td class=
\"
notes_content parallel new
\"
></td></tr>
"
;
rowCssToAdd
=
"
<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
old
\"
></td><td class=
\"
notes_content parallel old
\"
><div class=
\"
content
\"
></div></td><td class=
\"
notes_line new
\"
></td><td class=
\"
notes_content parallel new
\"
><div class=
\"
content
\"
></div
></td></tr>
"
;
}
}
notesContentSelector
+=
"
.content
"
;
if
(
hasNotes
)
{
if
(
hasNotes
)
{
notesContent
=
nextRow
.
find
(
targetContent
);
nextRow
.
show
();
notesContent
=
nextRow
.
find
(
notesContentSelector
);
if
(
notesContent
.
length
)
{
if
(
notesContent
.
length
)
{
notesContent
.
show
();
replyButton
=
notesContent
.
find
(
"
.js-discussion-reply-button:visible
"
);
replyButton
=
notesContent
.
find
(
"
.js-discussion-reply-button:visible
"
);
if
(
replyButton
.
length
)
{
if
(
replyButton
.
length
)
{
e
.
target
=
replyButton
[
0
];
e
.
target
=
replyButton
[
0
];
...
@@ -660,11 +663,13 @@
...
@@ -660,11 +663,13 @@
}
}
}
else
{
}
else
{
row
.
after
(
rowCssToAdd
);
row
.
after
(
rowCssToAdd
);
nextRow
=
row
.
next
();
notesContent
=
nextRow
.
find
(
notesContentSelector
);
addForm
=
true
;
addForm
=
true
;
}
}
if
(
addForm
)
{
if
(
addForm
)
{
newForm
=
this
.
formClone
.
clone
();
newForm
=
this
.
formClone
.
clone
();
newForm
.
appendTo
(
row
.
next
().
find
(
targetContent
)
);
newForm
.
appendTo
(
notesContent
);
return
this
.
setupDiscussionNoteForm
(
$link
,
newForm
);
return
this
.
setupDiscussionNoteForm
(
$link
,
newForm
);
}
}
};
};
...
...
app/models/note.rb
View file @
6d9715d8
...
@@ -88,7 +88,6 @@ class Note < ActiveRecord::Base
...
@@ -88,7 +88,6 @@ class Note < ActiveRecord::Base
def
grouped_diff_discussions
def
grouped_diff_discussions
active_notes
=
diff_notes
.
fresh
.
select
(
&
:active?
)
active_notes
=
diff_notes
.
fresh
.
select
(
&
:active?
)
Discussion
.
for_diff_notes
(
active_notes
).
Discussion
.
for_diff_notes
(
active_notes
).
reject
(
&
:resolved?
).
map
{
|
d
|
[
d
.
line_code
,
d
]
}.
to_h
map
{
|
d
|
[
d
.
line_code
,
d
]
}.
to_h
end
end
...
...
app/views/discussions/_diff_discussion.html.haml
View file @
6d9715d8
%tr
.notes_holder
-
expanded
=
local_assigns
.
fetch
(
:expanded
,
discussion
.
expanded?
)
%tr
.notes_holder
{
class:
(
'hide'
unless
expanded
)}
%td
.notes_line
{
colspan:
2
}
%td
.notes_line
{
colspan:
2
}
%td
.notes_content
%td
.notes_content
%ul
.notes
{
data:
{
discussion_id:
discussion
.
id
}
}
.content
=
render
partial:
"projects/notes/note"
,
collection:
discussion
.
notes
,
as: :note
=
render
"discussions/notes"
,
discussion:
discussion
.discussion-reply-holder
.discussion-with-resolve-btn
{
role:
"group"
}
.btn-group
{
role:
"group"
}
=
link_to_reply_discussion
(
discussion
)
.btn-group
{
role:
"group"
}
=
render
"discussions/resolve_all"
,
discussion:
discussion
=
render
"discussions/jump_to_next"
,
discussion:
discussion
app/views/discussions/_diff_with_notes.html.haml
View file @
6d9715d8
...
@@ -11,4 +11,4 @@
...
@@ -11,4 +11,4 @@
=
render
"projects/diffs/line"
,
line:
line
,
diff_file:
diff_file
,
plain:
true
=
render
"projects/diffs/line"
,
line:
line
,
diff_file:
diff_file
,
plain:
true
-
if
discussion
.
for_line?
(
line
)
-
if
discussion
.
for_line?
(
line
)
=
render
"discussions/diff_discussion"
,
discussion:
discussion
=
render
"discussions/diff_discussion"
,
discussion:
discussion
,
expanded:
true
app/views/discussions/_discussion.html.haml
View file @
6d9715d8
...
@@ -44,4 +44,5 @@
...
@@ -44,4 +44,5 @@
-
if
discussion
.
diff_discussion?
&&
discussion
.
diff_file
-
if
discussion
.
diff_discussion?
&&
discussion
.
diff_file
=
render
"discussions/diff_with_notes"
,
discussion:
discussion
=
render
"discussions/diff_with_notes"
,
discussion:
discussion
-
else
-
else
=
render
"discussions/notes"
,
discussion:
discussion
.panel.panel-default
=
render
"discussions/notes"
,
discussion:
discussion
app/views/discussions/_notes.html.haml
View file @
6d9715d8
.panel.panel-default
%ul
.notes
{
data:
{
discussion_id:
discussion
.
id
}
}
.notes
{
data:
{
discussion_id:
discussion
.
id
}
}
=
render
partial:
"projects/notes/note"
,
collection:
discussion
.
notes
,
as: :note
%ul
.notes.timeline
=
render
partial:
"projects/notes/note"
,
collection:
discussion
.
notes
,
as: :note
.discussion-reply-holder
.discussion-reply-holder
-
if
discussion
.
diff_discussion?
-
line_type
=
local_assigns
.
fetch
(
:line_type
,
nil
)
.btn-group-justified.discussion-with-resolve-btn
{
role:
"group"
}
.btn-group
{
role:
"group"
}
=
link_to_reply_discussion
(
discussion
,
line_type
)
.btn-group
{
role:
"group"
}
=
render
"discussions/resolve_all"
,
discussion:
discussion
=
render
"discussions/jump_to_next"
,
discussion:
discussion
-
else
=
link_to_reply_discussion
(
discussion
)
=
link_to_reply_discussion
(
discussion
)
app/views/discussions/_parallel_diff_discussion.html.haml
View file @
6d9715d8
%tr
.notes_holder
-
expanded
=
discussion_left
.
try
(
:expanded?
)
||
discussion_right
.
try
(
:expanded?
)
%tr
.notes_holder
{
class:
(
'hide'
unless
expanded
)}
-
if
discussion_left
-
if
discussion_left
%td
.notes_line.old
%td
.notes_line.old
%td
.notes_content.parallel.old
%td
.notes_content.parallel.old
%ul
.notes
{
data:
{
discussion_id:
discussion_left
.
id
}
}
.content
{
class:
(
'hide'
unless
discussion_left
.
expanded?
)}
=
render
partial:
"projects/notes/note"
,
collection:
discussion_left
.
notes
,
as: :note
=
render
"discussions/notes"
,
discussion:
discussion_left
,
line_type:
'old'
.discussion-reply-holder
.btn-group-justified.discussion-with-resolve-btn
{
role:
"group"
}
.btn-group
{
role:
"group"
}
=
link_to_reply_discussion
(
discussion_left
,
'old'
)
.btn-group
{
role:
"group"
}
=
render
"discussions/resolve_all"
,
discussion:
discussion_left
=
render
"discussions/jump_to_next"
,
discussion:
discussion_left
-
else
-
else
%td
.notes_line.old
=
""
%td
.notes_line.old
=
""
%td
.notes_content.parallel.old
=
""
%td
.notes_content.parallel.old
.content
-
if
discussion_right
-
if
discussion_right
%td
.notes_line.new
%td
.notes_line.new
%td
.notes_content.parallel.new
%td
.notes_content.parallel.new
%ul
.notes
{
data:
{
discussion_id:
discussion_right
.
id
}
}
.content
{
class:
(
'hide'
unless
discussion_right
.
expanded?
)}
=
render
partial:
"projects/notes/note"
,
collection:
discussion_right
.
notes
,
as: :note
=
render
"discussions/notes"
,
discussion:
discussion_right
,
line_type:
'new'
.discussion-reply-holder
.btn-group-justified.discussion-with-resolve-btn
{
role:
"group"
}
.btn-group
{
role:
"group"
}
=
link_to_reply_discussion
(
discussion_right
,
'new'
)
.btn-group
{
role:
"group"
}
=
render
"discussions/resolve_all"
,
discussion:
discussion_right
=
render
"discussions/jump_to_next"
,
discussion:
discussion_right
-
else
-
else
%td
.notes_line.new
=
""
%td
.notes_line.new
=
""
%td
.notes_content.parallel.new
=
""
%td
.notes_content.parallel.new
.content
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