Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-11-11 21:08:55 +00:00
parent 6d5a18ac65
commit 15f6e7bab5
8 changed files with 42 additions and 17 deletions

View file

@ -170,5 +170,8 @@ export const diffLines = state => (file, unifiedDiffComponents) => {
return null; return null;
} }
return parallelizeDiffLines(file.highlighted_diff_lines || []); return parallelizeDiffLines(
file.highlighted_diff_lines || [],
state.diffViewType === INLINE_DIFF_VIEW_TYPE,
);
}; };

View file

@ -36,9 +36,12 @@ export const isMeta = line => ['match', 'new-nonewline', 'old-nonewline'].includ
* *
* @param {Object[]} diffLines - inline diff lines * @param {Object[]} diffLines - inline diff lines
* *
* @param {Boolean} inline - is inline context or not
*
* @returns {Object[]} parallel lines * @returns {Object[]} parallel lines
*/ */
export const parallelizeDiffLines = (diffLines = []) => {
export const parallelizeDiffLines = (diffLines, inline) => {
let freeRightIndex = null; let freeRightIndex = null;
const lines = []; const lines = [];
@ -57,7 +60,7 @@ export const parallelizeDiffLines = (diffLines = []) => {
} }
index += 1; index += 1;
} else if (isAdded(line)) { } else if (isAdded(line)) {
if (freeRightIndex !== null) { if (freeRightIndex !== null && !inline) {
// If an old line came before this without a line on the right, this // If an old line came before this without a line on the right, this
// line can be put to the right of it. // line can be put to the right of it.
lines[freeRightIndex].right = line; lines[freeRightIndex].right = line;

View file

@ -641,12 +641,12 @@ table.code {
} }
} }
.diff-grid-left .old:nth-child(2) [data-linenumber], .diff-grid-left .old:nth-child(1) [data-linenumber],
.diff-grid-right .new:nth-child(2) [data-linenumber] { .diff-grid-right .new:nth-child(2) [data-linenumber] {
display: inline; display: inline;
} }
.diff-grid-left .old:nth-child(3) [data-linenumber], .diff-grid-left .old:nth-child(2) [data-linenumber],
.diff-grid-right .new:nth-child(1) [data-linenumber] { .diff-grid-right .new:nth-child(1) [data-linenumber] {
display: none; display: none;
} }

View file

@ -0,0 +1,5 @@
---
title: Fix unified component inline display
merge_request: 47345
author:
type: fixed

View file

@ -78,7 +78,7 @@ CAUTION: **Warning:**
The default behavior of [Delayed Project deletion](https://gitlab.com/gitlab-org/gitlab/-/issues/32935) in GitLab 12.6 was changed to The default behavior of [Delayed Project deletion](https://gitlab.com/gitlab-org/gitlab/-/issues/32935) in GitLab 12.6 was changed to
[Immediate deletion](https://gitlab.com/gitlab-org/gitlab/-/issues/220382) in GitLab 13.2. [Immediate deletion](https://gitlab.com/gitlab-org/gitlab/-/issues/220382) in GitLab 13.2.
Projects within a group can be deleted after a delayed period, by [configuring in Group Settings](../../group/index.md#enabling-delayed-project-removal). Projects within a group (but not a personal namespace) can be deleted after a delayed period, by [configuring in Group Settings](../../group/index.md#enabling-delayed-project-removal).
The default period is 7 days, and can be changed. Setting this period to 0 will enable immediate removal The default period is 7 days, and can be changed. Setting this period to 0 will enable immediate removal
of projects or groups. of projects or groups.

View file

@ -192,17 +192,7 @@ To delete a project, first navigate to the home page for that project.
1. Click **Delete project** 1. Click **Delete project**
1. Confirm this action by typing in the expected text. 1. Confirm this action by typing in the expected text.
### Delayed deletion **(PREMIUM)** Projects in personal namespaces are deleted immediately on request. For information on delayed deletion of projects within a group, please see [Enabling delayed project removal](../group/index.md#enabling-delayed-project-removal).
By default, projects in a personal namespace are deleted after a seven day delay.
Admins can restore the project during this period of time.
This delay [may be changed by an admin](../admin_area/settings/visibility_and_access_controls.md#default-deletion-delay).
Admins can view all projects pending deletion. If you're an administrator, go to the top navigation bar, click **Projects > Your projects**, and then select the **Deleted projects** tab.
From this tab an admin can restore any project.
For information on delay deletion of projects within a group, please see [Enabling delayed Project removal](../group/index.md#enabling-delayed-project-removal)
## CI/CD for external repositories **(PREMIUM)** ## CI/CD for external repositories **(PREMIUM)**

View file

@ -18551,6 +18551,9 @@ msgstr ""
msgid "Not all data has been processed yet, the accuracy of the chart for the selected timeframe is limited." msgid "Not all data has been processed yet, the accuracy of the chart for the selected timeframe is limited."
msgstr "" msgstr ""
msgid "Not applicable to personal namespaced projects, which are deleted immediately on request."
msgstr ""
msgid "Not available" msgid "Not available"
msgstr "" msgstr ""

View file

@ -1221,5 +1221,26 @@ describe('DiffsStoreUtils', () => {
file.parallel_diff_lines, file.parallel_diff_lines,
); );
}); });
/**
* What's going on here?
*
* The inline version of parallelizeDiffLines simply keeps the difflines
* in the same order they are received as opposed to shuffling them
* to be "side by side".
*
* This keeps the underlying data structure the same which simplifies
* the components, but keeps the changes grouped together as users
* expect when viewing changes inline.
*/
it('converts inline diff lines to inline diff lines with a parallel structure', () => {
const file = getDiffFileMock();
const files = utils.parallelizeDiffLines(file.highlighted_diff_lines, true);
expect(files[5].left).toEqual(file.parallel_diff_lines[5].left);
expect(files[5].right).toBeNull();
expect(files[6].left).toBeNull();
expect(files[6].right).toEqual(file.parallel_diff_lines[5].right);
});
}); });
}); });