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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b01fd7ad
Commit
b01fd7ad
authored
Apr 12, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes unresolved discussions rendering the error state instead of the diff
parent
1e54e30f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
7 deletions
+41
-7
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+13
-6
app/assets/stylesheets/framework/buttons.scss
app/assets/stylesheets/framework/buttons.scss
+4
-0
app/views/discussions/_diff_with_notes.html.haml
app/views/discussions/_diff_with_notes.html.haml
+1
-1
changelogs/unreleased/45271-collpased-diff-loading.yml
changelogs/unreleased/45271-collpased-diff-loading.yml
+5
-0
spec/features/merge_request/user_scrolls_to_note_on_load_spec.rb
...atures/merge_request/user_scrolls_to_note_on_load_spec.rb
+18
-0
No files found.
app/assets/javascripts/notes.js
View file @
b01fd7ad
...
@@ -19,7 +19,7 @@ import AjaxCache from '~/lib/utils/ajax_cache';
...
@@ -19,7 +19,7 @@ import AjaxCache from '~/lib/utils/ajax_cache';
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
syntaxHighlight
from
'
~/syntax_highlight
'
;
import
syntaxHighlight
from
'
~/syntax_highlight
'
;
import
SkeletonLoadingContainer
from
'
~/vue_shared/components/skeleton_loading_container.vue
'
;
import
SkeletonLoadingContainer
from
'
~/vue_shared/components/skeleton_loading_container.vue
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
Flash
from
'
./flash
'
;
import
Flash
from
'
./flash
'
;
...
@@ -1434,10 +1434,11 @@ export default class Notes {
...
@@ -1434,10 +1434,11 @@ export default class Notes {
static
renderDiffError
(
$container
)
{
static
renderDiffError
(
$container
)
{
$container
.
find
(
'
.line_content
'
).
html
(
$container
.
find
(
'
.line_content
'
).
html
(
$
(
`
$
(
`
<div class="nothing-here-block">
<div class="js-error-load-lazy-diff nothing-here-block">
${
__
(
${
sprintf
(
__
(
'
Unable to load the diff.%{buttonStartTag}Try again%{buttonEndTag}?
'
),
{
'
Unable to load the diff.
'
,
buttonStartTag
:
'
<button type="button" class="btn-link btn-no-padding js-toggle-lazy-diff">
'
,
)}
<a class="js-toggle-lazy-diff" href="javascript:void(0)">Try again</a>?
buttonEndTag
:
'
</button>
'
},
false
)}
</div>
</div>
`
),
`
),
);
);
...
@@ -1455,7 +1456,12 @@ export default class Notes {
...
@@ -1455,7 +1456,12 @@ export default class Notes {
const
fileHolder
=
$container
.
find
(
'
.file-holder
'
);
const
fileHolder
=
$container
.
find
(
'
.file-holder
'
);
const
url
=
fileHolder
.
data
(
'
linesPath
'
);
const
url
=
fileHolder
.
data
(
'
linesPath
'
);
axios
/**
* We only fetch resolved discussions.
* Unresolved discussions don't have an endpoint being provided.
*/
if
(
url
)
{
axios
.
get
(
url
)
.
get
(
url
)
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
Notes
.
renderDiffContent
(
$container
,
data
);
Notes
.
renderDiffContent
(
$container
,
data
);
...
@@ -1463,6 +1469,7 @@ export default class Notes {
...
@@ -1463,6 +1469,7 @@ export default class Notes {
.
catch
(()
=>
{
.
catch
(()
=>
{
Notes
.
renderDiffError
(
$container
);
Notes
.
renderDiffError
(
$container
);
});
});
}
}
}
toggleCommitList
(
e
)
{
toggleCommitList
(
e
)
{
...
...
app/assets/stylesheets/framework/buttons.scss
View file @
b01fd7ad
...
@@ -485,3 +485,7 @@ fieldset[disabled] .btn,
...
@@ -485,3 +485,7 @@ fieldset[disabled] .btn,
@extend
%disabled
;
@extend
%disabled
;
}
}
}
}
.btn-no-padding
{
padding
:
0
;
}
\ No newline at end of file
app/views/discussions/_diff_with_notes.html.haml
View file @
b01fd7ad
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
-
unless
expanded
-
unless
expanded
-
diff_data
=
{
lines_path:
project_merge_request_discussion_path
(
discussion
.
project
,
discussion
.
noteable
,
discussion
)
}
-
diff_data
=
{
lines_path:
project_merge_request_discussion_path
(
discussion
.
project
,
discussion
.
noteable
,
discussion
)
}
.diff-file.file-holder
{
class:
diff_file_class
,
data:
diff_data
}
.diff-file.file-holder
.js-lazy-load-discussion
{
class:
diff_file_class
,
data:
diff_data
}
.js-file-title.file-title.file-title-flex-parent
.js-file-title.file-title.file-title-flex-parent
.file-header-content
.file-header-content
=
render
"projects/diffs/file_header"
,
diff_file:
diff_file
,
url:
discussion_path
(
discussion
),
show_toggle:
false
=
render
"projects/diffs/file_header"
,
diff_file:
diff_file
,
url:
discussion_path
(
discussion
),
show_toggle:
false
...
...
changelogs/unreleased/45271-collpased-diff-loading.yml
0 → 100644
View file @
b01fd7ad
---
title
:
Fixes unresolved discussions rendering the error state instead of the diff
merge_request
:
author
:
type
:
fixed
spec/features/merge_request/user_scrolls_to_note_on_load_spec.rb
View file @
b01fd7ad
...
@@ -27,6 +27,24 @@ describe 'Merge request > User scrolls to note on load', :js do
...
@@ -27,6 +27,24 @@ describe 'Merge request > User scrolls to note on load', :js do
expect
(
fragment_position_top
).
to
be
<
(
page_scroll_y
+
page_height
)
expect
(
fragment_position_top
).
to
be
<
(
page_scroll_y
+
page_height
)
end
end
it
'renders un-collapsed notes with diff'
do
page
.
current_window
.
resize_to
(
1000
,
1000
)
visit
"
#{
project_merge_request_path
(
project
,
merge_request
)
}#{
fragment_id
}
"
page
.
execute_script
"window.scrollTo(0,0)"
note_element
=
find
(
fragment_id
)
note_container
=
note_element
.
ancestor
(
'.js-toggle-container'
)
expect
(
note_element
.
visible?
).
to
eq
true
page
.
within
note_container
do
expect
(
page
).
not_to
have_selector
(
'.js-error-load-lazy-diff'
)
end
end
it
'expands collapsed notes'
do
it
'expands collapsed notes'
do
visit
"
#{
project_merge_request_path
(
project
,
merge_request
)
}#{
collapsed_fragment_id
}
"
visit
"
#{
project_merge_request_path
(
project
,
merge_request
)
}#{
collapsed_fragment_id
}
"
note_element
=
find
(
collapsed_fragment_id
)
note_element
=
find
(
collapsed_fragment_id
)
...
...
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