Resolve "Expanding a diff while having an open comment form will always scroll down to the comment"
Closes#51606
See merge request gitlab-org/gitlab-ce!23849
The diff notes automatically focus on mount, and when using the index
(as opposed to line_code) for the v-bind:key, the comment form gets
unnecessarily remounted, and therefore refocused.
The empty state now only gets shown when no files exist in the branch.
If the user is reviewing 2 versions with no files, we don't show the state.
Refactors the diff app spec to use Vue test utils.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/48635
We don't need a series of attributes to render diff files on
discussions.json request. Therefore this MR removes lots of unnecessary
attributes from the request, mainly the highlighted diff lines, which
are pretty expensive.
Improve the renderign of new and existing discussions
by reducing the number of watchers on each object & array.
Previously every discussion change would trigger an update for every
discussion component.
Also tidied up some components to get them closer to our docs.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51506
This caused many pain points when working with it.
Part of the data was camel cased the other snake case.
Other parts where snake case & then getting converted in components,
this conversion has the potential for leaking memory.
This changes that & makes it consistent with what it returned from the
API, snake case.
This restores the behaviour of showing the expand all button on diffs
even when only a single file is collapsed.
Previously the button would only show when all files are collapsed.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51737
This re-implements image commenting in merge request diffs.
This feature was previously lost when the merge request
page was refactored into Vue.
With this, we create an overlay component. The overlay
component handles displaying the comment badges
and the comment form badge.
Badges are displayed based on the position attribute
sent with the discussion.
Comment forms for diff files are controlled through
a different state property. This is so we don't
tie comment forms to diff files directly creating
deep nested state. Instead we create a flat array
which holds the file hash & the X & Y position of
the comment form.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/48956
This fixes a bug where a discussion on a none changed line
would not get fully removed and therefore leave the comment row
empty. This was caused by the discussiob being added
to the right when it shouldnt of been
This also fixes a very rare edge case where discussions would get added
twice to diff lines causing a Vue rendering warning
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/53317
This adds toggle buttons to switch between file & tree list.
For file list, it renders the truncated paths with the ellipsis
at the start of the path.
When focusing the input, it hides the toggle buttons.
On blur, the buttons get shown again.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51859