From bc8f298b647859a411d38a440c397e5990ef4941 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 26 Nov 2021 09:10:08 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_manual_todo.yml | 6 +++++ Gemfile | 2 +- Gemfile.lock | 4 ++-- .../diffs/components/diff_file.vue | 2 +- app/services/pages/zip_directory_service.rb | 4 +++- app/views/projects/blob/_content.html.haml | 1 + app/views/projects/blob/_header.html.haml | 1 + app/views/projects/diffs/_content.html.haml | 1 + .../shared/wikis/_wiki_content.html.haml | 2 ++ app/views/shared/wikis/show.html.haml | 3 +-- .../admin_area/analytics/dev_ops_report.md | 2 +- lib/safe_zip/extract.rb | 2 +- qa/qa/page/component/wiki.rb | 5 ++++- spec/frontend/fixtures/raw.rb | 22 +++++++++++-------- 14 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 app/views/shared/wikis/_wiki_content.html.haml diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml index 5dec3096913..f47e76b858d 100644 --- a/.rubocop_manual_todo.yml +++ b/.rubocop_manual_todo.yml @@ -2774,3 +2774,9 @@ GraphQL/ResolverMethodLength: - 'app/graphql/types/ci/runner_type.rb' - 'app/graphql/types/ci/stage_type.rb' - 'app/graphql/types/packages/package_type.rb' + +# Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/345673 +Performance/Rubyzip: + Exclude: + - 'app/services/packages/nuget/metadata_extraction_service.rb' + - 'lib/gitlab/ci/artifact_file_reader.rb' diff --git a/Gemfile b/Gemfile index e671d6ec802..4a6ad99a76a 100644 --- a/Gemfile +++ b/Gemfile @@ -376,7 +376,7 @@ group :development, :test do gem 'spring', '~> 2.1.0' gem 'spring-commands-rspec', '~> 1.0.4' - gem 'gitlab-styles', '~> 6.5.0', require: false + gem 'gitlab-styles', '~> 6.6.0', require: false gem 'haml_lint', '~> 0.36.0', require: false gem 'bundler-audit', '~> 0.7.0.1', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 07565f86390..f508dab2d8e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -497,7 +497,7 @@ GEM openid_connect (~> 1.2) gitlab-sidekiq-fetcher (0.8.0) sidekiq (~> 6.1) - gitlab-styles (6.5.0) + gitlab-styles (6.6.0) rubocop (~> 0.91, >= 0.91.1) rubocop-gitlab-security (~> 0.1.1) rubocop-graphql (~> 0.10) @@ -1479,7 +1479,7 @@ DEPENDENCIES gitlab-net-dns (~> 0.9.1) gitlab-omniauth-openid-connect (~> 0.8.0) gitlab-sidekiq-fetcher (= 0.8.0) - gitlab-styles (~> 6.5.0) + gitlab-styles (~> 6.6.0) gitlab_chronic_duration (~> 0.10.6.2) gitlab_omniauth-ldap (~> 2.1.1) gon (~> 6.4.0) diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index d09cc064b2c..4e77bf81c1e 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -10,6 +10,7 @@ import { import { escape } from 'lodash'; import { mapActions, mapGetters, mapState } from 'vuex'; import { IdState } from 'vendor/vue-virtual-scroller'; +import DiffContent from 'jh_else_ce/diffs/components/diff_content.vue'; import createFlash from '~/flash'; import { hasDiff } from '~/helpers/diffs_helper'; import { diffViewerErrors } from '~/ide/constants'; @@ -28,7 +29,6 @@ import { import eventHub from '../event_hub'; import { DIFF_FILE, GENERIC_ERROR, CONFLICT_TEXT } from '../i18n'; import { collapsedType, getShortShaFromFile } from '../utils/diff_file'; -import DiffContent from './diff_content.vue'; import DiffFileHeader from './diff_file_header.vue'; export default { diff --git a/app/services/pages/zip_directory_service.rb b/app/services/pages/zip_directory_service.rb index 895614a84a0..c9029b9666a 100644 --- a/app/services/pages/zip_directory_service.rb +++ b/app/services/pages/zip_directory_service.rb @@ -25,7 +25,9 @@ module Pages FileUtils.rm_f(output_file) entries_count = 0 - ::Zip::File.open(output_file, ::Zip::File::CREATE) do |zipfile| + # Since we're writing not reading here, we can safely silence the cop. + # It currently cannot discern between opening for reading or writing. + ::Zip::File.open(output_file, ::Zip::File::CREATE) do |zipfile| # rubocop:disable Performance/Rubyzip write_entry(zipfile, PUBLIC_DIR) entries_count = zipfile.entries.count end diff --git a/app/views/projects/blob/_content.html.haml b/app/views/projects/blob/_content.html.haml index 7afbd85cd6d..0031be36098 100644 --- a/app/views/projects/blob/_content.html.haml +++ b/app/views/projects/blob/_content.html.haml @@ -1,3 +1,4 @@ +- blob = local_assigns.fetch(:blob, nil) - simple_viewer = blob.simple_viewer - rich_viewer = blob.rich_viewer - rich_viewer_active = rich_viewer && params[:viewer] != 'simple' diff --git a/app/views/projects/blob/_header.html.haml b/app/views/projects/blob/_header.html.haml index dad4ea205b4..74df53a8d15 100644 --- a/app/views/projects/blob/_header.html.haml +++ b/app/views/projects/blob/_header.html.haml @@ -1,4 +1,5 @@ - blame = local_assigns.fetch(:blame, false) +- blob = local_assigns.fetch(:blob, nil) .js-file-title.file-title-flex-parent = render 'projects/blob/header_content', blob: blob diff --git a/app/views/projects/diffs/_content.html.haml b/app/views/projects/diffs/_content.html.haml index 590fcdb0234..718f129cba8 100644 --- a/app/views/projects/diffs/_content.html.haml +++ b/app/views/projects/diffs/_content.html.haml @@ -1,2 +1,3 @@ +- diff_file = local_assigns.fetch(:diff_file, nil) .diff-content = render 'projects/diffs/viewer', viewer: diff_file.viewer diff --git a/app/views/shared/wikis/_wiki_content.html.haml b/app/views/shared/wikis/_wiki_content.html.haml new file mode 100644 index 00000000000..42e8037bb0f --- /dev/null +++ b/app/views/shared/wikis/_wiki_content.html.haml @@ -0,0 +1,2 @@ +.js-wiki-page-content.md.gl-pt-2{ data: { qa_selector: 'wiki_page_content', testid: 'wiki_page_content', tracking_context: wiki_page_tracking_context(@page).to_json } } + = render_wiki_content(@page) diff --git a/app/views/shared/wikis/show.html.haml b/app/views/shared/wikis/show.html.haml index 8a5cd94bde9..e6980aae3e1 100644 --- a/app/views/shared/wikis/show.html.haml +++ b/app/views/shared/wikis/show.html.haml @@ -26,7 +26,6 @@ %div - if can?(current_user, :create_wiki, @wiki.container) && @page.latest? && @valid_encoding = link_to sprite_icon('pencil', css_class: 'gl-icon'), wiki_page_path(@wiki, @page, action: :edit), title: 'Edit', role: "button", class: 'btn gl-button btn-icon btn-default js-wiki-edit', data: { qa_selector: 'edit_page_button', testid: 'wiki_edit_button' } - .js-wiki-page-content.md.gl-pt-2{ data: { qa_selector: 'wiki_page_content', testid: 'wiki_page_content', tracking_context: wiki_page_tracking_context(@page).to_json } } - = render_wiki_content(@page) + = render 'shared/wikis/wiki_content' = render 'shared/wikis/sidebar' diff --git a/doc/user/admin_area/analytics/dev_ops_report.md b/doc/user/admin_area/analytics/dev_ops_report.md index 62fea3c266a..b28789cfd5b 100644 --- a/doc/user/admin_area/analytics/dev_ops_report.md +++ b/doc/user/admin_area/analytics/dev_ops_report.md @@ -37,7 +37,7 @@ information is **not sent** to any other GitLab instances. If you have just started using GitLab, it might take a few weeks for data to be collected before this feature is available. -## DevOps Adoption **(ULTIMATE SELF)** +## DevOps Adoption **(ULTIMATE)** > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/247112) in GitLab 13.7 as a [Beta feature](https://about.gitlab.com/handbook/product/gitlab-the-product/#beta). > - The Overview tab [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/330401) in GitLab 14.1. diff --git a/lib/safe_zip/extract.rb b/lib/safe_zip/extract.rb index ac33f0b3c2c..74df7895afe 100644 --- a/lib/safe_zip/extract.rb +++ b/lib/safe_zip/extract.rb @@ -25,7 +25,7 @@ module SafeZip private def extract_with_ruby_zip(params) - ::Zip::File.open(archive_path) do |zip_archive| + ::Zip::File.open(archive_path) do |zip_archive| # rubocop:disable Performance/Rubyzip # Extract all files in the following order: # 1. Directories first, # 2. Files next, diff --git a/qa/qa/page/component/wiki.rb b/qa/qa/page/component/wiki.rb index c3db1d6c885..ffd31f8d7b7 100644 --- a/qa/qa/page/component/wiki.rb +++ b/qa/qa/page/component/wiki.rb @@ -11,10 +11,13 @@ module QA base.view 'app/views/shared/wikis/show.html.haml' do element :wiki_page_title - element :wiki_page_content element :edit_page_button end + base.view 'app/views/shared/wikis/_wiki_content.html.haml' do + element :wiki_page_content + end + base.view 'app/views/shared/wikis/_main_links.html.haml' do element :new_page_button element :page_history_button diff --git a/spec/frontend/fixtures/raw.rb b/spec/frontend/fixtures/raw.rb index 211c4e7c048..b117cfea5fa 100644 --- a/spec/frontend/fixtures/raw.rb +++ b/spec/frontend/fixtures/raw.rb @@ -7,41 +7,45 @@ RSpec.describe 'Raw files', '(JavaScript fixtures)' do let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'raw-project') } - let(:response) { @blob.data.force_encoding('UTF-8') } + let(:response) { @response } + + def blob_at(commit, path) + @response = project.repository.blob_at(commit, path).data.force_encoding('UTF-8') + end after do remove_repository(project) end it 'blob/notebook/basic.json' do - @blob = project.repository.blob_at('6d85bb69', 'files/ipython/basic.ipynb') + blob_at('6d85bb69', 'files/ipython/basic.ipynb') end it 'blob/notebook/markdown-table.json' do - @blob = project.repository.blob_at('f6b7a707', 'files/ipython/markdown-table.ipynb') + blob_at('f6b7a707', 'files/ipython/markdown-table.ipynb') end it 'blob/notebook/worksheets.json' do - @blob = project.repository.blob_at('6d85bb69', 'files/ipython/worksheets.ipynb') + blob_at('6d85bb69', 'files/ipython/worksheets.ipynb') end it 'blob/notebook/math.json' do - @blob = project.repository.blob_at('93ee732', 'files/ipython/math.ipynb') + blob_at('93ee732', 'files/ipython/math.ipynb') end it 'blob/pdf/test.pdf' do - @blob = project.repository.blob_at('e774ebd33', 'files/pdf/test.pdf') + blob_at('e774ebd33', 'files/pdf/test.pdf') end it 'blob/text/README.md' do - @blob = project.repository.blob_at('e774ebd33', 'README.md') + blob_at('e774ebd33', 'README.md') end it 'blob/images/logo-white.png' do - @blob = project.repository.blob_at('e774ebd33', 'files/images/logo-white.png') + blob_at('e774ebd33', 'files/images/logo-white.png') end it 'blob/binary/Gemfile.zip' do - @blob = project.repository.blob_at('e774ebd33', 'Gemfile.zip') + blob_at('e774ebd33', 'Gemfile.zip') end end