Commit 7480d774 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 69d6d3ca
import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils'; import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils';
import { decorateData, sortTree, escapeFileUrl } from '../stores/utils'; import { escapeFileUrl } from '~/lib/utils/url_utility';
import { decorateData, sortTree } from '../stores/utils';
export const splitParent = path => { export const splitParent = path => {
const idx = path.lastIndexOf('/'); const idx = path.lastIndexOf('/');
......
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { joinPaths } from '~/lib/utils/url_utility'; import { joinPaths, escapeFileUrl } from '~/lib/utils/url_utility';
import { escapeFileUrl } from '../stores/utils';
import Api from '~/api'; import Api from '~/api';
export default { export default {
......
import { joinPaths } from '~/lib/utils/url_utility'; import { joinPaths, escapeFileUrl } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
import eventHub from '../../eventhub'; import eventHub from '../../eventhub';
import service from '../../services'; import service from '../../services';
import * as types from '../mutation_types'; import * as types from '../mutation_types';
import router from '../../ide_router'; import router from '../../ide_router';
import { escapeFileUrl, addFinalNewlineIfNeeded, setPageTitleForFile } from '../utils'; import { addFinalNewlineIfNeeded, setPageTitleForFile } from '../utils';
import { viewerTypes, stageKeys } from '../../constants'; import { viewerTypes, stageKeys } from '../../constants';
export const closeFile = ({ commit, state, dispatch }, file) => { export const closeFile = ({ commit, state, dispatch }, file) => {
......
import { commitActionTypes, FILE_VIEW_MODE_EDITOR } from '../constants'; import { commitActionTypes, FILE_VIEW_MODE_EDITOR } from '../constants';
import { escapeFileUrl } from '~/lib/utils/url_utility';
export const dataStructure = () => ({ export const dataStructure = () => ({
id: '', id: '',
...@@ -217,8 +218,6 @@ export const mergeTrees = (fromTree, toTree) => { ...@@ -217,8 +218,6 @@ export const mergeTrees = (fromTree, toTree) => {
return toTree; return toTree;
}; };
export const escapeFileUrl = fileUrl => encodeURIComponent(fileUrl).replace(/%2F/g, '/');
export const replaceFileUrl = (url, oldPath, newPath) => { export const replaceFileUrl = (url, oldPath, newPath) => {
// Add `/-/` so that we don't accidentally replace project path // Add `/-/` so that we don't accidentally replace project path
const result = url.replace(`/-/${escapeFileUrl(oldPath)}`, `/-/${escapeFileUrl(newPath)}`); const result = url.replace(`/-/${escapeFileUrl(oldPath)}`, `/-/${escapeFileUrl(newPath)}`);
......
...@@ -280,3 +280,5 @@ export const setUrlParams = (params, url = window.location.href, clearParams = f ...@@ -280,3 +280,5 @@ export const setUrlParams = (params, url = window.location.href, clearParams = f
return urlObj.toString(); return urlObj.toString();
}; };
export const escapeFileUrl = fileUrl => encodeURIComponent(fileUrl).replace(/%2F/g, '/');
---
title: Upgrade to Gitaly v1.76.0
merge_request: 21857
author:
type: changed
# frozen_string_literal: true
class BackfillVersionAuthorAndCreatedAt < ActiveRecord::Migration[5.2]
DOWNTIME = false
MIGRATION = 'BackfillVersionDataFromGitaly'.freeze
BATCH_SIZE = 500
disable_ddl_transaction!
class Project < ActiveRecord::Base
self.table_name = 'projects'
self.inheritance_column = :_type_disabled
end
class Issue < ActiveRecord::Base
self.table_name = 'issues'
self.inheritance_column = :_type_disabled
end
class Version < ActiveRecord::Base
include EachBatch
self.table_name = 'design_management_versions'
self.inheritance_column = :_type_disabled
# Returns unique issue ids of versions that are not in projects
# that are pending deletion.
scope :with_unique_issue_ids, -> do
versions = Version.arel_table
issues = Issue.arel_table
projects = Project.arel_table
Version.select(versions[:issue_id]).where(
versions[:author_id].eq(nil).or(
versions[:created_at].eq(nil)
).and(
issues[:project_id].not_in(
projects.project(projects[:id]).where(projects[:pending_delete].eq(true))
)
)
).joins(
versions.join(issues).on(
issues[:id].eq(versions[:issue_id])
).join_sources
).distinct
end
end
# This migration will make around ~1300 UPDATE queries on GitLab.com,
# one per design_management_versions record as the migration will update
# each record individually.
#
# It will make around 870 Gitaly `ListCommitsByOid` requests on GitLab.com.
# One for every unique issue with design_management_versions records.
def up
return unless Gitlab.ee? # no-op for CE
Version.with_unique_issue_ids.each_batch(of: BATCH_SIZE) do |versions, index|
jobs = versions.map { |version| [MIGRATION, [version.issue_id]] }
BackgroundMigrationWorker.bulk_perform_async(jobs)
end
end
def down
# no-op
end
end
...@@ -175,7 +175,7 @@ Check the [`production.log`](../administration/logs.md#productionlog) ...@@ -175,7 +175,7 @@ Check the [`production.log`](../administration/logs.md#productionlog)
on your GitLab server to obtain further details. If you are getting the error like on your GitLab server to obtain further details. If you are getting the error like
`Faraday::ConnectionFailed (execution expired)` in the log, there may be a connectivity issue `Faraday::ConnectionFailed (execution expired)` in the log, there may be a connectivity issue
between your GitLab instance and GitHub Enterprise. To verify it, [start the rails console](https://docs.gitlab.com/omnibus/maintenance/#starting-a-rails-console-session) between your GitLab instance and GitHub Enterprise. To verify it, [start the rails console](https://docs.gitlab.com/omnibus/maintenance/#starting-a-rails-console-session)
and run the commands below replacing <github_url> with the URL of your GitHub Enterprise instance: and run the commands below replacing `<github_url>` with the URL of your GitHub Enterprise instance:
```ruby ```ruby
uri = URI.parse("https://<github_url>") # replace `GitHub-URL` with the real one here uri = URI.parse("https://<github_url>") # replace `GitHub-URL` with the real one here
......
...@@ -272,7 +272,7 @@ ee: ...@@ -272,7 +272,7 @@ ee:
- :push_event_payload - :push_event_payload
- design_versions: - design_versions:
- actions: - actions:
- :design # Duplicate export of issues.designs in order to link the record to both Issue and DesignVersion - :design # Duplicate export of issues.designs in order to link the record to both Issue and Action
- protected_branches: - protected_branches:
- :unprotect_access_levels - :unprotect_access_levels
- protected_environments: - protected_environments:
......
import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils'; import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils';
import { decorateFiles, splitParent } from '~/ide/lib/files'; import { decorateFiles, splitParent } from '~/ide/lib/files';
import { decorateData, escapeFileUrl } from '~/ide/stores/utils'; import { decorateData } from '~/ide/stores/utils';
import { escapeFileUrl } from '~/lib/utils/url_utility';
const TEST_BRANCH_ID = 'lorem-ipsum'; const TEST_BRANCH_ID = 'lorem-ipsum';
const TEST_PROJECT_ID = 10; const TEST_PROJECT_ID = 10;
......
...@@ -2,7 +2,7 @@ import axios from 'axios'; ...@@ -2,7 +2,7 @@ import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import services from '~/ide/services'; import services from '~/ide/services';
import Api from '~/api'; import Api from '~/api';
import { escapeFileUrl } from '~/ide/stores/utils'; import { escapeFileUrl } from '~/lib/utils/url_utility';
jest.mock('~/api'); jest.mock('~/api');
......
...@@ -395,14 +395,6 @@ describe('Multi-file store utils', () => { ...@@ -395,14 +395,6 @@ describe('Multi-file store utils', () => {
}); });
}); });
describe('escapeFileUrl', () => {
it('encodes URL excluding the slashes', () => {
expect(utils.escapeFileUrl('/foo-bar/file.md')).toBe('/foo-bar/file.md');
expect(utils.escapeFileUrl('foo bar/file.md')).toBe('foo%20bar/file.md');
expect(utils.escapeFileUrl('foo/bar/file.md')).toBe('foo/bar/file.md');
});
});
describe('swapInStateArray', () => { describe('swapInStateArray', () => {
let localState; let localState;
......
...@@ -322,6 +322,14 @@ describe('URL utility', () => { ...@@ -322,6 +322,14 @@ describe('URL utility', () => {
expect(urlUtils.joinPaths(...paths)).toBe(expected); expect(urlUtils.joinPaths(...paths)).toBe(expected);
}); });
}); });
describe('escapeFileUrl', () => {
it('encodes URL excluding the slashes', () => {
expect(urlUtils.escapeFileUrl('/foo-bar/file.md')).toBe('/foo-bar/file.md');
expect(urlUtils.escapeFileUrl('foo bar/file.md')).toBe('foo%20bar/file.md');
expect(urlUtils.escapeFileUrl('foo/bar/file.md')).toBe('foo/bar/file.md');
});
});
}); });
describe('setUrlParams', () => { describe('setUrlParams', () => {
......
...@@ -549,6 +549,7 @@ actions: ...@@ -549,6 +549,7 @@ actions:
- design - design
- version - version
versions: &version versions: &version
- author
- issue - issue
- designs - designs
- actions - actions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment