diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-20 12:10:03 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-20 12:10:03 +0000 |
commit | 43b4b3e2d2ddebc0a89b94a8251c162ec5719780 (patch) | |
tree | 8a21146370cfd1b24b25cfcacef53e889746f5aa | |
parent | 196ada0844fff7642463fbd08a44609a1e1fa713 (diff) | |
download | gitlab-ce-43b4b3e2d2ddebc0a89b94a8251c162ec5719780.tar.gz |
Add latest changes from gitlab-org/gitlab@master
30 files changed, 260 insertions, 76 deletions
diff --git a/Procfile b/Procfile deleted file mode 100644 index 1776fd97942..00000000000 --- a/Procfile +++ /dev/null @@ -1,6 +0,0 @@ -# For DEVELOPMENT only. Production uses Runit in -# https://gitlab.com/gitlab-org/omnibus-gitlab or the init scripts in -# lib/support/init.d, which call scripts in bin/ . -# -web: RAILS_ENV=development bin/web start_foreground -worker: RAILS_ENV=development bin/background_jobs start_foreground diff --git a/app/assets/javascripts/filtered_search/dropdown_operator.js b/app/assets/javascripts/filtered_search/dropdown_operator.js index d9794e326f8..0c8c8140ee9 100644 --- a/app/assets/javascripts/filtered_search/dropdown_operator.js +++ b/app/assets/javascripts/filtered_search/dropdown_operator.js @@ -24,10 +24,12 @@ export default class DropdownOperator extends FilteredSearchDropdown { if (selected.tagName === 'LI') { if (selected.hasAttribute('data-value')) { + const name = FilteredSearchVisualTokens.getLastTokenPartial(); const operator = selected.dataset.value; + FilteredSearchVisualTokens.removeLastTokenPartial(); FilteredSearchDropdownManager.addWordToInput({ - tokenName: this.filter, + tokenName: name, tokenOperator: operator, clicked: false, }); @@ -38,8 +40,6 @@ export default class DropdownOperator extends FilteredSearchDropdown { } renderContent(forceShowList = false) { - this.filter = FilteredSearchVisualTokens.getLastTokenPartial(); - const dropdownData = [ { tag: 'equal', diff --git a/app/assets/javascripts/groups/components/group_folder.vue b/app/assets/javascripts/groups/components/group_folder.vue index cf8c9bf74ec..8c7192b49a0 100644 --- a/app/assets/javascripts/groups/components/group_folder.vue +++ b/app/assets/javascripts/groups/components/group_folder.vue @@ -35,7 +35,7 @@ export default { </script> <template> - <ul class="content-list group-list-tree"> + <ul class="groups-list group-list-tree"> <group-item v-for="(group, index) in groups" :key="index" diff --git a/app/assets/javascripts/groups/constants.js b/app/assets/javascripts/groups/constants.js index e27265b7b4a..c538934a37d 100644 --- a/app/assets/javascripts/groups/constants.js +++ b/app/assets/javascripts/groups/constants.js @@ -8,7 +8,7 @@ export const ACTIVE_TAB_ARCHIVED = 'archived'; export const GROUPS_LIST_HOLDER_CLASS = '.js-groups-list-holder'; export const GROUPS_FILTER_FORM_CLASS = '.js-group-filter-form'; -export const CONTENT_LIST_CLASS = '.content-list'; +export const CONTENT_LIST_CLASS = '.groups-list'; export const COMMON_STR = { FAILURE: __('An error occurred. Please try again.'), diff --git a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js index 34a024b1b33..f64e0bbbfda 100644 --- a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js +++ b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js @@ -10,9 +10,30 @@ export default () => { const $broadcastMessageType = $('.js-broadcast-message-type'); const $broadcastBannerMessagePreview = $('.js-broadcast-banner-message-preview'); const $broadcastMessage = $('.js-broadcast-message-message'); - const previewPath = $broadcastMessage.data('previewPath'); const $jsBroadcastMessagePreview = $('.js-broadcast-message-preview'); + const reloadPreview = function reloadPreview() { + const previewPath = $broadcastMessage.data('previewPath'); + const message = $broadcastMessage.val(); + const type = $broadcastMessageType.val(); + + if (message === '') { + $jsBroadcastMessagePreview.text(__('Your message here')); + } else { + axios + .post(previewPath, { + broadcast_message: { + message, + broadcast_type: type, + }, + }) + .then(({ data }) => { + $jsBroadcastMessagePreview.html(data.message); + }) + .catch(() => flash(__('An error occurred while rendering preview broadcast message'))); + } + }; + $broadcastMessageColor.on('input', function onMessageColorInput() { const previewColor = $(this).val(); $broadcastBannerMessagePreview.css('background-color', previewColor); @@ -32,26 +53,14 @@ export default () => { $broadcastMessageDismissableFormGroup.toggleClass('hidden'); $broadcastBannerMessagePreview.toggleClass('hidden'); $broadcastNotificationMessagePreview.toggleClass('hidden'); + + reloadPreview(); }); $broadcastMessage.on( 'input', - debounce(function onMessageInput() { - const message = $(this).val(); - if (message === '') { - $jsBroadcastMessagePreview.text(__('Your message here')); - } else { - axios - .post(previewPath, { - broadcast_message: { - message, - }, - }) - .then(({ data }) => { - $jsBroadcastMessagePreview.html(data.message); - }) - .catch(() => flash(__('An error occurred while rendering preview broadcast message'))); - } + debounce(() => { + reloadPreview(); }, 250), ); diff --git a/app/assets/javascripts/repository/log_tree.js b/app/assets/javascripts/repository/log_tree.js index ade92cc92e0..8cad4a14f31 100644 --- a/app/assets/javascripts/repository/log_tree.js +++ b/app/assets/javascripts/repository/log_tree.js @@ -27,9 +27,9 @@ export function fetchLogsTree(client, path, offset, resolver = null) { fetchpromise = axios .get( - `${gon.relative_url_root}/${projectPath}/-/refs/${escape(ref)}/logs_tree/${encodeURIComponent( - path.replace(/^\//, ''), - )}`, + `${gon.relative_url_root}/${projectPath}/-/refs/${encodeURIComponent( + ref, + )}/logs_tree/${encodeURIComponent(path.replace(/^\//, ''))}`, { params: { format: 'json', offset }, }, diff --git a/app/assets/javascripts/repository/router.js b/app/assets/javascripts/repository/router.js index 2386773699c..d74447dd566 100644 --- a/app/assets/javascripts/repository/router.js +++ b/app/assets/javascripts/repository/router.js @@ -12,7 +12,7 @@ export default function createRouter(base, baseRef) { base: joinPaths(gon.relative_url_root || '', base), routes: [ { - path: `(/-)?/tree/${escape(baseRef)}/:path*`, + path: `(/-)?/tree/(${encodeURIComponent(baseRef)}|${baseRef})/:path*`, name: 'treePath', component: TreePage, props: route => ({ diff --git a/app/assets/stylesheets/pages/groups.scss b/app/assets/stylesheets/pages/groups.scss index 305956e1baf..f6edf86e96e 100644 --- a/app/assets/stylesheets/pages/groups.scss +++ b/app/assets/stylesheets/pages/groups.scss @@ -8,6 +8,32 @@ } } +.groups-list { + @include basic-list; + display: flex; + flex-direction: column; + margin: 0; + + .group-row-contents .controls > .btn:last-child { + margin: 0; + } + + li { + .title { + font-weight: 600; + } + + a { + color: $gray-900; + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } + } +} + .group-root-path { max-width: 40vw; overflow: hidden; @@ -15,11 +41,6 @@ word-wrap: nowrap; } -.content-list .group-name { - font-weight: $gl-font-weight-bold; - color: $pages-group-name-color; -} - .group-row { @include basic-list-stats; @@ -322,10 +343,6 @@ table.pipeline-project-metrics tr td { } } - .content-list li:last-child { - padding-bottom: 0; - } - .group-list-tree { margin-bottom: 0; margin-left: 30px; diff --git a/app/controllers/concerns/snippets_actions.rb b/app/controllers/concerns/snippets_actions.rb index a18cdd58abb..749afb71923 100644 --- a/app/controllers/concerns/snippets_actions.rb +++ b/app/controllers/concerns/snippets_actions.rb @@ -4,6 +4,11 @@ module SnippetsActions extend ActiveSupport::Concern def edit + # We need to load some info from the existing blob + snippet.content = blob.data + snippet.file_name = blob.path + + render 'edit' end def raw @@ -25,6 +30,18 @@ module SnippetsActions private + # rubocop:disable Gitlab/ModuleWithInstanceVariables + def blob + return unless snippet + + @blob ||= if Feature.enabled?(:version_snippets, current_user) && !snippet.repository.empty? + snippet.blobs.first + else + snippet.blob + end + end + # rubocop:enable Gitlab/ModuleWithInstanceVariables + def convert_line_endings(content) params[:line_ending] == 'raw' ? content : content.gsub(/\r\n/, "\n") end diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index 48cd42347fc..da0e3a44f05 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -121,16 +121,6 @@ class Projects::SnippetsController < Projects::ApplicationController alias_method :awardable, :snippet alias_method :spammable, :snippet - def blob - return unless snippet - - @blob ||= if Feature.enabled?(:version_snippets, current_user) && !snippet.repository.empty? - snippet.blobs.first - else - snippet.blob - end - end - def spammable_path project_snippet_path(@project, @snippet) end diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 070391c4b51..a07baa1a045 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -126,16 +126,6 @@ class SnippetsController < ApplicationController alias_method :awardable, :snippet alias_method :spammable, :snippet - def blob - return unless snippet - - @blob ||= if Feature.enabled?(:version_snippets, current_user) && !snippet.repository.empty? - snippet.blobs.first - else - snippet.blob - end - end - def spammable_path snippet_path(@snippet) end diff --git a/app/views/groups/_subgroups_and_projects.html.haml b/app/views/groups/_subgroups_and_projects.html.haml index 784f5ac233e..cb15fe339e1 100644 --- a/app/views/groups/_subgroups_and_projects.html.haml +++ b/app/views/groups/_subgroups_and_projects.html.haml @@ -2,7 +2,7 @@ .empty-state.hidden = render "shared/groups/empty_state" - %ul.content-list{ data: { hide_projects: 'false', group_id: group.id, path: group_path(group) } } + %section{ data: { hide_projects: 'false', group_id: group.id, path: group_path(group) } } .js-groups-list-holder .loading-container.text-center.prepend-top-20 .spinner.spinner-md diff --git a/changelogs/unreleased/211641-store-external-issue-identifier-on-import.yml b/changelogs/unreleased/211641-store-external-issue-identifier-on-import.yml new file mode 100644 index 00000000000..5da251bc2ef --- /dev/null +++ b/changelogs/unreleased/211641-store-external-issue-identifier-on-import.yml @@ -0,0 +1,5 @@ +--- +title: Add a DB column to track external issue and epic ids when importing from external sources +merge_request: 27522 +author: +type: added diff --git a/changelogs/unreleased/filtered-search-bug.yml b/changelogs/unreleased/filtered-search-bug.yml new file mode 100644 index 00000000000..d1d90b9ca0c --- /dev/null +++ b/changelogs/unreleased/filtered-search-bug.yml @@ -0,0 +1,5 @@ +--- +title: Fix filtered search tokenization +merge_request: 27648 +author: +type: fixed diff --git a/changelogs/unreleased/fj-fix-snippet-edit-page.yml b/changelogs/unreleased/fj-fix-snippet-edit-page.yml new file mode 100644 index 00000000000..e87fb0ec8bf --- /dev/null +++ b/changelogs/unreleased/fj-fix-snippet-edit-page.yml @@ -0,0 +1,5 @@ +--- +title: Show the proper information in snippet edit form +merge_request: 27479 +author: +type: fixed diff --git a/changelogs/unreleased/ph-209033-chineseCharsInVueRouter.yml b/changelogs/unreleased/ph-209033-chineseCharsInVueRouter.yml new file mode 100644 index 00000000000..9341abded7e --- /dev/null +++ b/changelogs/unreleased/ph-209033-chineseCharsInVueRouter.yml @@ -0,0 +1,5 @@ +--- +title: Fixes the repository Vue router not working with Chinese characters +merge_request: 27494 +author: +type: fixed diff --git a/db/migrate/20200318162148_add_external_key_to_issues_table.rb b/db/migrate/20200318162148_add_external_key_to_issues_table.rb new file mode 100644 index 00000000000..eeac6ae3155 --- /dev/null +++ b/db/migrate/20200318162148_add_external_key_to_issues_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddExternalKeyToIssuesTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :issues, :external_key, :string, limit: 255 + end + end + + def down + with_lock_retries do + remove_column :issues, :external_key + end + end +end diff --git a/db/migrate/20200318163148_add_index_on_external_key_to_issues_table.rb b/db/migrate/20200318163148_add_index_on_external_key_to_issues_table.rb new file mode 100644 index 00000000000..adca6c3b493 --- /dev/null +++ b/db/migrate/20200318163148_add_index_on_external_key_to_issues_table.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnExternalKeyToIssuesTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index(:issues, [:project_id, :external_key], unique: true, where: 'external_key IS NOT NULL') + end + + def down + remove_concurrent_index(:issues, [:project_id, :external_key]) + end +end diff --git a/db/migrate/20200318164448_add_external_key_to_epics_table.rb b/db/migrate/20200318164448_add_external_key_to_epics_table.rb new file mode 100644 index 00000000000..c21fb1698bc --- /dev/null +++ b/db/migrate/20200318164448_add_external_key_to_epics_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddExternalKeyToEpicsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :epics, :external_key, :string, limit: 255 + end + end + + def down + with_lock_retries do + remove_column :epics, :external_key + end + end +end diff --git a/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb b/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb new file mode 100644 index 00000000000..0f3b2dbe3ee --- /dev/null +++ b/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnExternalKeyToEpicsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index(:epics, [:group_id, :external_key], unique: true, where: 'external_key IS NOT NULL') + end + + def down + remove_concurrent_index(:epics, [:group_id, :external_key]) + end +end diff --git a/db/schema.rb b/db/schema.rb index 2ecc0b9b2d6..74167ad30c4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1606,6 +1606,7 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do t.integer "start_date_sourcing_epic_id" t.integer "due_date_sourcing_epic_id" t.integer "health_status", limit: 2 + t.string "external_key", limit: 255 t.index "group_id, ((iid)::character varying) varchar_pattern_ops", name: "index_epics_on_group_id_and_iid_varchar_pattern" t.index ["assignee_id"], name: "index_epics_on_assignee_id" t.index ["author_id"], name: "index_epics_on_author_id" @@ -1613,6 +1614,7 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do t.index ["due_date_sourcing_epic_id"], name: "index_epics_on_due_date_sourcing_epic_id", where: "(due_date_sourcing_epic_id IS NOT NULL)" t.index ["due_date_sourcing_milestone_id"], name: "index_epics_on_due_date_sourcing_milestone_id" t.index ["end_date"], name: "index_epics_on_end_date" + t.index ["group_id", "external_key"], name: "index_epics_on_group_id_and_external_key", unique: true, where: "(external_key IS NOT NULL)" t.index ["group_id"], name: "index_epics_on_group_id" t.index ["iid"], name: "index_epics_on_iid" t.index ["lock_version"], name: "index_epics_on_lock_version", where: "(lock_version IS NULL)" @@ -2222,6 +2224,7 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do t.integer "duplicated_to_id" t.integer "promoted_to_epic_id" t.integer "health_status", limit: 2 + t.string "external_key", limit: 255 t.index ["author_id", "id", "created_at"], name: "index_issues_on_author_id_and_id_and_created_at" t.index ["author_id"], name: "index_issues_on_author_id" t.index ["closed_by_id"], name: "index_issues_on_closed_by_id" @@ -2233,6 +2236,7 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do t.index ["moved_to_id"], name: "index_issues_on_moved_to_id", where: "(moved_to_id IS NOT NULL)" t.index ["project_id", "created_at", "id", "state_id"], name: "idx_issues_on_project_id_and_created_at_and_id_and_state_id" t.index ["project_id", "due_date", "id", "state_id"], name: "idx_issues_on_project_id_and_due_date_and_id_and_state_id", where: "(due_date IS NOT NULL)" + t.index ["project_id", "external_key"], name: "index_issues_on_project_id_and_external_key", unique: true, where: "(external_key IS NOT NULL)" t.index ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true t.index ["project_id", "relative_position", "state_id", "id"], name: "idx_issues_on_project_id_and_rel_position_and_state_id_and_id", order: { id: :desc } t.index ["project_id", "updated_at", "id", "state_id"], name: "idx_issues_on_project_id_and_updated_at_and_id_and_state_id" diff --git a/doc/user/application_security/sast/index.md b/doc/user/application_security/sast/index.md index 90e6fcbf1d1..fc4f82c8196 100644 --- a/doc/user/application_security/sast/index.md +++ b/doc/user/application_security/sast/index.md @@ -268,6 +268,11 @@ See [Analyzer settings](#analyzer-settings) for the complete list of available o SAST can be [configured](#customizing-the-sast-settings) using environment variables. +#### Custom Certificate Authority + +To trust a custom Certificate Authority, set the `ADDITIONAL_CA_CERT_BUNDLE` variable to the bundle +of CA certs that you want to trust within the SAST environment. + #### Docker images The following are Docker image-related variables. diff --git a/lib/gitlab/danger/helper.rb b/lib/gitlab/danger/helper.rb index c5174da4b7c..77a84634815 100644 --- a/lib/gitlab/danger/helper.rb +++ b/lib/gitlab/danger/helper.rb @@ -144,7 +144,7 @@ module Gitlab %r{\A(ee/)?spec/(?!javascripts|frontend)[^/]+} => :backend, %r{\A(ee/)?vendor/(?!assets)[^/]+} => :backend, %r{\A(ee/)?vendor/(languages\.yml|licenses\.csv)\z} => :backend, - %r{\A(Gemfile|Gemfile.lock|Procfile|Rakefile)\z} => :backend, + %r{\A(Gemfile|Gemfile.lock|Rakefile)\z} => :backend, %r{\A[A-Z_]+_VERSION\z} => :backend, %r{\A\.rubocop(_todo)?\.yml\z} => :backend, diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index 76785534ec7..5b336f994f7 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -77,7 +77,7 @@ describe 'Dashboard Groups page', :js do expect(page).to have_content(group.name) expect(page).to have_content(nested_group.parent.name) expect(page).not_to have_content(another_group.name) - expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 + expect(page.all('.js-groups-list-holder .groups-list li').length).to eq 2 end end diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index 9686eee18fc..c14144ab3d5 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -47,26 +47,26 @@ describe 'Explore Groups page', :js do expect(page).to have_content(group.full_name) expect(page).to have_content(public_group.full_name) expect(page).not_to have_content(private_group.full_name) - expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 + expect(page.all('.js-groups-list-holder .groups-list li').length).to eq 2 end it 'shows non-archived projects count' do # Initially project is not archived - expect(find('.js-groups-list-holder .content-list li:first-child .stats .number-projects')).to have_text("1") + expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1") # Archive project ::Projects::UpdateService.new(empty_project, user, archived: true).execute visit explore_groups_path # Check project count - expect(find('.js-groups-list-holder .content-list li:first-child .stats .number-projects')).to have_text("0") + expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("0") # Unarchive project ::Projects::UpdateService.new(empty_project, user, archived: false).execute visit explore_groups_path # Check project count - expect(find('.js-groups-list-holder .content-list li:first-child .stats .number-projects')).to have_text("1") + expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1") end describe 'landing component' do diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index 29111bff344..3c50cb4c997 100644 --- a/spec/features/issues/filtered_search/visual_tokens_spec.rb +++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb @@ -162,4 +162,17 @@ describe 'Visual tokens', :js do ]) end end + + it 'does retain hint token when mix of typing and clicks are performed' do + input_filtered_search('label:', extra_space: false, submit: false) + + expect(page).to have_css('#js-dropdown-operator', visible: true) + + find('#js-dropdown-operator li[data-value="="]').click + + token = page.all('.tokens-container .js-visual-token')[0] + + expect(token.find('.name').text).to eq('Label') + expect(token.find('.operator').text).to eq('=') + end end diff --git a/spec/features/projects/snippets/user_updates_snippet_spec.rb b/spec/features/projects/snippets/user_updates_snippet_spec.rb index f9628b37089..bad3fde8a4a 100644 --- a/spec/features/projects/snippets/user_updates_snippet_spec.rb +++ b/spec/features/projects/snippets/user_updates_snippet_spec.rb @@ -2,13 +2,17 @@ require 'spec_helper' -describe 'Projects > Snippets > User updates a snippet' do +describe 'Projects > Snippets > User updates a snippet', :js do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, namespace: user.namespace) } - let!(:snippet) { create(:project_snippet, project: project, author: user) } + let_it_be(:snippet, reload: true) { create(:project_snippet, :repository, project: project, author: user) } + + let(:version_snippet_enabled) { true } before do stub_feature_flags(snippets_vue: false) + stub_feature_flags(version_snippets: version_snippet_enabled) + project.add_maintainer(user) sign_in(user) @@ -17,6 +21,29 @@ describe 'Projects > Snippets > User updates a snippet' do page.within('.detail-page-header') do first(:link, 'Edit').click end + wait_for_all_requests + end + + it 'displays the snippet blob path and content' do + blob = snippet.blobs.first + + aggregate_failures do + expect(page.find_field('project_snippet_file_name').value).to eq blob.path + expect(page.find('.file-content')).to have_content(blob.data.strip) + expect(page.find('.snippet-file-content', visible: false).value).to eq blob.data + end + end + + context 'when feature flag :version_snippets is disabled' do + let(:version_snippet_enabled) { false } + + it 'displays the snippet file_name and content' do + aggregate_failures do + expect(page.find_field('project_snippet_file_name').value).to eq snippet.file_name + expect(page.find('.file-content')).to have_content(snippet.content) + expect(page.find('.snippet-file-content', visible: false).value).to eq snippet.content + end + end end it 'updates a snippet' do diff --git a/spec/features/snippets/user_edits_snippet_spec.rb b/spec/features/snippets/user_edits_snippet_spec.rb index b003e50aab7..0bbb92b1f3f 100644 --- a/spec/features/snippets/user_edits_snippet_spec.rb +++ b/spec/features/snippets/user_edits_snippet_spec.rb @@ -5,18 +5,43 @@ require 'spec_helper' describe 'User edits snippet', :js do include DropzoneHelper - let(:file_name) { 'test.rb' } - let(:content) { 'puts "test"' } - + let_it_be(:file_name) { 'test.rb' } + let_it_be(:content) { 'puts "test"' } let_it_be(:user) { create(:user) } - let(:snippet) { create(:personal_snippet, :public, file_name: file_name, content: content, author: user) } + let_it_be(:snippet, reload: true) { create(:personal_snippet, :repository, :public, file_name: file_name, content: content, author: user) } + + let(:version_snippet_enabled) { true } before do stub_feature_flags(snippets_vue: false) + stub_feature_flags(version_snippets: version_snippet_enabled) + sign_in(user) visit edit_snippet_path(snippet) - wait_for_requests + wait_for_all_requests + end + + it 'displays the snippet blob path and content' do + blob = snippet.blobs.first + + aggregate_failures do + expect(page.find_field('personal_snippet_file_name').value).to eq blob.path + expect(page.find('.file-content')).to have_content(blob.data.strip) + expect(page.find('.snippet-file-content', visible: false).value).to eq blob.data + end + end + + context 'when feature flag :version_snippets is disabled' do + let(:version_snippet_enabled) { false } + + it 'displays the snippet file_name and content' do + aggregate_failures do + expect(page.find_field('personal_snippet_file_name').value).to eq file_name + expect(page.find('.file-content')).to have_content(content) + expect(page.find('.snippet-file-content', visible: false).value).to eq content + end + end end it 'updates the snippet' do diff --git a/spec/lib/gitlab/danger/helper_spec.rb b/spec/lib/gitlab/danger/helper_spec.rb index dd183281977..1c9df641655 100644 --- a/spec/lib/gitlab/danger/helper_spec.rb +++ b/spec/lib/gitlab/danger/helper_spec.rb @@ -206,7 +206,6 @@ describe Gitlab::Danger::Helper do 'Gemfile' | :backend 'Gemfile.lock' | :backend - 'Procfile' | :backend 'Rakefile' | :backend 'FOO_VERSION' | :backend diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml index 4c9caaa181a..5b0444c394e 100644 --- a/spec/lib/gitlab/import_export/safe_model_attributes.yml +++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml @@ -31,6 +31,7 @@ Issue: - last_edited_by_id - discussion_locked - health_status +- external_key Event: - id - target_type @@ -843,6 +844,7 @@ Epic: - start_date_sourcing_epic_id - due_date_sourcing_epic_id - health_status + - external_key EpicIssue: - id - relative_position |