diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-29 00:06:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-29 00:06:10 +0000 |
commit | abfafe3c57f56cd76a0a9afb7275cddb12304544 (patch) | |
tree | f1a82b1afe78f1fd37234f86f3107bc8eb976742 | |
parent | ef326e805ac99222c55e1efd9867045800f01a4b (diff) | |
download | gitlab-ce-abfafe3c57f56cd76a0a9afb7275cddb12304544.tar.gz |
Add latest changes from gitlab-org/gitlab@master
100 files changed, 363 insertions, 21 deletions
diff --git a/app/controllers/projects/pages_domains_controller.rb b/app/controllers/projects/pages_domains_controller.rb index c287e440db0..50a47e98893 100644 --- a/app/controllers/projects/pages_domains_controller.rb +++ b/app/controllers/projects/pages_domains_controller.rb @@ -62,6 +62,14 @@ class Projects::PagesDomainsController < Projects::ApplicationController end end + def clean_certificate + unless @domain.update(user_provided_certificate: nil, user_provided_key: nil) + flash[:alert] = @domain.errors.full_messages.join(', ') + end + + redirect_to edit_project_pages_domain_path(@project, @domain) + end + private def create_params diff --git a/app/models/clusters/instance.rb b/app/models/clusters/instance.rb index f21dbdf7f26..8c9d9ab9ab1 100644 --- a/app/models/clusters/instance.rb +++ b/app/models/clusters/instance.rb @@ -9,5 +9,9 @@ module Clusters def feature_available?(feature) ::Feature.enabled?(feature, default_enabled: true) end + + def flipper_id + self.class.to_s + end end end diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 3e17d75c02c..8a79c5f889d 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -355,7 +355,7 @@ class IssuableBaseService < BaseService associations = { labels: issuable.labels.to_a, - mentioned_users: issuable.mentioned_users.to_a, + mentioned_users: issuable.mentioned_users(current_user).to_a, assignees: issuable.assignees.to_a } associations[:total_time_spent] = issuable.total_time_spent if issuable.respond_to?(:total_time_spent) diff --git a/app/views/clusters/clusters/gcp/_form.html.haml b/app/views/clusters/clusters/gcp/_form.html.haml index cca16ce7eda..95670a2ec87 100644 --- a/app/views/clusters/clusters/gcp/_form.html.haml +++ b/app/views/clusters/clusters/gcp/_form.html.haml @@ -64,12 +64,13 @@ %p.form-text.text-muted = s_('ClusterIntegration|Learn more about %{help_link_start_machine_type}machine types%{help_link_end} and %{help_link_start_pricing}pricing%{help_link_end}.').html_safe % { help_link_start_machine_type: help_link_start % { url: machine_type_link_url }, help_link_start_pricing: help_link_start % { url: pricing_link_url }, help_link_end: help_link_end } - .form-group - = provider_gcp_field.check_box :cloud_run, { label: s_('ClusterIntegration|Enable Cloud Run on GKE (beta)'), - label_class: 'label-bold' } - .form-text.text-muted - = s_('ClusterIntegration|Uses the Cloud Run, Istio, and HTTP Load Balancing addons for this cluster.') - = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'cloud-run-on-gke'), target: '_blank' + - if Feature.enabled?(:create_cloud_run_clusters, clusterable) + .form-group + = provider_gcp_field.check_box :cloud_run, { label: s_('ClusterIntegration|Enable Cloud Run on GKE (beta)'), + label_class: 'label-bold' } + .form-text.text-muted + = s_('ClusterIntegration|Uses the Cloud Run, Istio, and HTTP Load Balancing addons for this cluster.') + = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'cloud-run-on-gke'), target: '_blank' .form-group = field.check_box :managed, { label: s_('ClusterIntegration|GitLab-managed cluster'), diff --git a/changelogs/unreleased/33902-fix-private-group-todo-mentions.yml b/changelogs/unreleased/33902-fix-private-group-todo-mentions.yml new file mode 100644 index 00000000000..52405fe7553 --- /dev/null +++ b/changelogs/unreleased/33902-fix-private-group-todo-mentions.yml @@ -0,0 +1,5 @@ +--- +title: Do not generate To-Dos additional when editing group mentions +merge_request: 19037 +author: +type: fixed diff --git a/changelogs/unreleased/sh-change-throttle-protected-paths-default.yml b/changelogs/unreleased/sh-change-throttle-protected-paths-default.yml new file mode 100644 index 00000000000..ef6cb80a280 --- /dev/null +++ b/changelogs/unreleased/sh-change-throttle-protected-paths-default.yml @@ -0,0 +1,5 @@ +--- +title: Disable protected path throttling by default +merge_request: 19185 +author: +type: fixed diff --git a/config/initializers/0_inflections.rb b/config/initializers/0_inflections.rb index c0afa207ac3..7690eafdc6b 100644 --- a/config/initializers/0_inflections.rb +++ b/config/initializers/0_inflections.rb @@ -12,18 +12,19 @@ ActiveSupport::Inflector.inflections do |inflect| inflect.uncountable %w( award_emoji - project_statistics - system_note_metadata + container_repository_registry + design_registry event_log - project_auto_devops - project_registry file_registry + group_view job_artifact_registry - container_repository_registry - design_registry - vulnerability_feedback + lfs_object_registry + project_auto_devops + project_registry + project_statistics + system_note_metadata vulnerabilities_feedback - group_view + vulnerability_feedback ) inflect.acronym 'EE' end diff --git a/config/routes/project.rb b/config/routes/project.rb index 3dd34083c44..ebd6b14be76 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -222,6 +222,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resources :domains, except: :index, controller: 'pages_domains', constraints: { id: %r{[^/]+} } do member do post :verify + delete :clean_certificate end end end diff --git a/db/migrate/20191026041447_change_default_value_of_throttle_protected_paths.rb b/db/migrate/20191026041447_change_default_value_of_throttle_protected_paths.rb new file mode 100644 index 00000000000..dd79fb217ef --- /dev/null +++ b/db/migrate/20191026041447_change_default_value_of_throttle_protected_paths.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class ChangeDefaultValueOfThrottleProtectedPaths < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + change_column_default :application_settings, :throttle_protected_paths_enabled, false + + # Because we already set the value to true in the previous + # migration, this feature was switched on inadvertently in GitLab + # 12.4. This migration toggles it back off to ensure we don't + # inadvertently block legitimate users. The admin will have to + # re-enable it in the application settings. + unless omnibus_protected_paths_present? + execute "UPDATE application_settings SET throttle_protected_paths_enabled = #{false_value}" + end + end + + def down + change_column_default :application_settings, :throttle_protected_paths_enabled, true + + execute "UPDATE application_settings SET throttle_protected_paths_enabled = #{true_value}" + end + + private + + def omnibus_protected_paths_present? + Rack::Attack.throttles.key?('protected paths') + rescue e + say "Error while checking if Omnibus protected paths were already enabled: #{e.message}" + say 'Continuing. Protected paths will remain enabled.' + + # Return true so we don't take a risk + true + end +end diff --git a/db/schema.rb b/db/schema.rb index dce9d1dc189..39c4f3005be 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_10_17_180026) do +ActiveRecord::Schema.define(version: 2019_10_26_041447) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" @@ -331,7 +331,7 @@ ActiveRecord::Schema.define(version: 2019_10_17_180026) do t.string "encrypted_asset_proxy_secret_key_iv" t.string "static_objects_external_storage_url", limit: 255 t.string "static_objects_external_storage_auth_token", limit: 255 - t.boolean "throttle_protected_paths_enabled", default: true, null: false + t.boolean "throttle_protected_paths_enabled", default: false, null: false t.integer "throttle_protected_paths_requests_per_period", default: 10, null: false t.integer "throttle_protected_paths_period_in_seconds", default: 60, null: false t.string "protected_paths", limit: 255, default: ["/users/password", "/users/sign_in", "/api/v3/session.json", "/api/v3/session", "/api/v4/session.json", "/api/v4/session", "/users", "/users/confirmation", "/unsubscribes/", "/import/github/personal_access_token"], array: true diff --git a/doc/user/markdown.md b/doc/user/markdown.md index 0b4bb43b4bf..43974a51205 100644 --- a/doc/user/markdown.md +++ b/doc/user/markdown.md @@ -417,9 +417,10 @@ GFM will recognize the following: > If this is not rendered correctly, [view it in GitLab itself](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/user/markdown.md#task-lists). -You can add task lists anywhere markdown is supported, but you can only "click" to -toggle the boxes if they are in issues, merge requests, or comments. In other places -you must edit the markdown manually to change the status by adding or removing the `x`. +You can add task lists anywhere Markdown is supported, but you can only "click" +to toggle the boxes if they are in issues, merge requests, or comments. In other +places you must edit the Markdown manually to change the status by adding or +removing an `x` within the square brackets. To create a task list, add a specially-formatted Markdown list. You can use either unordered or ordered lists: diff --git a/doc/user/search/advanced_search_syntax.md b/doc/user/search/advanced_search_syntax.md index d65dd32fe11..faa3a118137 100644 --- a/doc/user/search/advanced_search_syntax.md +++ b/doc/user/search/advanced_search_syntax.md @@ -17,6 +17,8 @@ The Advanced Syntax Search is a subset of the [Advanced Global Search](advanced_global_search.md), which you can use if you want to have more specific search results. +Advanced Global Search only supports searching the [default branch](../project/repository/branches/index.md#default-branch). + ## Use cases Let's say for example that the product you develop relies on the code of another diff --git a/spec/controllers/projects/pages_domains_controller_spec.rb b/spec/controllers/projects/pages_domains_controller_spec.rb index 032f4f1418f..1db1fff02d8 100644 --- a/spec/controllers/projects/pages_domains_controller_spec.rb +++ b/spec/controllers/projects/pages_domains_controller_spec.rb @@ -190,6 +190,56 @@ describe Projects::PagesDomainsController do end end + describe 'DELETE #clean_certificate' do + subject do + delete(:clean_certificate, params: request_params.merge(id: pages_domain.domain)) + end + + it 'redirects to edit page' do + subject + + expect(response).to redirect_to(edit_project_pages_domain_path(project, pages_domain)) + end + + it 'removes certificate' do + expect do + subject + end.to change { pages_domain.reload.certificate }.to(nil) + .and change { pages_domain.reload.key }.to(nil) + end + + it 'sets certificate source to user_provided' do + pages_domain.update!(certificate_source: :gitlab_provided) + + expect do + subject + end.to change { pages_domain.reload.certificate_source }.from("gitlab_provided").to("user_provided") + end + + context 'when pages_https_only is set' do + before do + project.update!(pages_https_only: true) + stub_pages_setting(external_https: '127.0.0.1') + end + + it 'does not remove certificate' do + subject + + pages_domain.reload + expect(pages_domain.certificate).to be_present + expect(pages_domain.key).to be_present + end + + it 'redirects to edit page with a flash message' do + subject + + expect(flash[:alert]).to include('Certificate') + expect(flash[:alert]).to include('Key') + expect(response).to redirect_to(edit_project_pages_domain_path(project, pages_domain)) + end + end + end + context 'pages disabled' do before do allow(Gitlab.config.pages).to receive(:enabled).and_return(false) diff --git a/spec/requests/api/access_requests_spec.rb b/spec/requests/api/access_requests_spec.rb index 100f3d33c7b..3bfca00776f 100644 --- a/spec/requests/api/access_requests_spec.rb +++ b/spec/requests/api/access_requests_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::AccessRequests do diff --git a/spec/requests/api/applications_spec.rb b/spec/requests/api/applications_spec.rb index 53fc3096751..438d5dbf018 100644 --- a/spec/requests/api/applications_spec.rb +++ b/spec/requests/api/applications_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Applications, :api do diff --git a/spec/requests/api/avatar_spec.rb b/spec/requests/api/avatar_spec.rb index 9bc49bd5982..c8bc7f8a4a2 100644 --- a/spec/requests/api/avatar_spec.rb +++ b/spec/requests/api/avatar_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Avatar do diff --git a/spec/requests/api/award_emoji_spec.rb b/spec/requests/api/award_emoji_spec.rb index 342fcfa1041..80040cddd4d 100644 --- a/spec/requests/api/award_emoji_spec.rb +++ b/spec/requests/api/award_emoji_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::AwardEmoji do diff --git a/spec/requests/api/badges_spec.rb b/spec/requests/api/badges_spec.rb index 771a78a2d91..ea0a7d4c9b7 100644 --- a/spec/requests/api/badges_spec.rb +++ b/spec/requests/api/badges_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Badges do diff --git a/spec/requests/api/boards_spec.rb b/spec/requests/api/boards_spec.rb index 0b9c0c2ebe9..8a67e956165 100644 --- a/spec/requests/api/boards_spec.rb +++ b/spec/requests/api/boards_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Boards do diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index d1e20cb1770..aecd1d0e71f 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Branches do diff --git a/spec/requests/api/broadcast_messages_spec.rb b/spec/requests/api/broadcast_messages_spec.rb index 0b48b79219c..541acb29857 100644 --- a/spec/requests/api/broadcast_messages_spec.rb +++ b/spec/requests/api/broadcast_messages_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::BroadcastMessages do diff --git a/spec/requests/api/commit_statuses_spec.rb b/spec/requests/api/commit_statuses_spec.rb index 2b5e8226403..639b8e96343 100644 --- a/spec/requests/api/commit_statuses_spec.rb +++ b/spec/requests/api/commit_statuses_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::CommitStatuses do diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb index 1648e3afa4b..fa24958a79f 100644 --- a/spec/requests/api/commits_spec.rb +++ b/spec/requests/api/commits_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'mime/types' diff --git a/spec/requests/api/deploy_keys_spec.rb b/spec/requests/api/deploy_keys_spec.rb index e0cc18abcca..4579ccfad80 100644 --- a/spec/requests/api/deploy_keys_spec.rb +++ b/spec/requests/api/deploy_keys_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::DeployKeys do diff --git a/spec/requests/api/discussions_spec.rb b/spec/requests/api/discussions_spec.rb index 0420201efe3..68f7d407b54 100644 --- a/spec/requests/api/discussions_spec.rb +++ b/spec/requests/api/discussions_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Discussions do diff --git a/spec/requests/api/doorkeeper_access_spec.rb b/spec/requests/api/doorkeeper_access_spec.rb index cfee3f6c0f8..2a34e623a7e 100644 --- a/spec/requests/api/doorkeeper_access_spec.rb +++ b/spec/requests/api/doorkeeper_access_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'doorkeeper access' do diff --git a/spec/requests/api/environments_spec.rb b/spec/requests/api/environments_spec.rb index 745f3c55ac8..aa273e97209 100644 --- a/spec/requests/api/environments_spec.rb +++ b/spec/requests/api/environments_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Environments do diff --git a/spec/requests/api/events_spec.rb b/spec/requests/api/events_spec.rb index 992fd5e9c66..9f8d254a00c 100644 --- a/spec/requests/api/events_spec.rb +++ b/spec/requests/api/events_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Events do diff --git a/spec/requests/api/features_spec.rb b/spec/requests/api/features_spec.rb index 4dd93e5ef31..dfd14f89dbf 100644 --- a/spec/requests/api/features_spec.rb +++ b/spec/requests/api/features_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Features do diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb index 21b67357543..ec18156f49f 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Files do diff --git a/spec/requests/api/graphql/gitlab_schema_spec.rb b/spec/requests/api/graphql/gitlab_schema_spec.rb index e1eb7c7f738..d02eccedf32 100644 --- a/spec/requests/api/graphql/gitlab_schema_spec.rb +++ b/spec/requests/api/graphql/gitlab_schema_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'GitlabSchema configurations' do diff --git a/spec/requests/api/graphql/mutations/merge_requests/set_wip_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/set_wip_spec.rb index bbc477ba485..4492c51dbd7 100644 --- a/spec/requests/api/graphql/mutations/merge_requests/set_wip_spec.rb +++ b/spec/requests/api/graphql/mutations/merge_requests/set_wip_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Setting WIP status of a merge request' do diff --git a/spec/requests/api/graphql/project/issues_spec.rb b/spec/requests/api/graphql/project/issues_spec.rb index 4f9f916f22e..3bac39b1aae 100644 --- a/spec/requests/api/graphql/project/issues_spec.rb +++ b/spec/requests/api/graphql/project/issues_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'getting an issue list for a project' do diff --git a/spec/requests/api/graphql/project/merge_request_spec.rb b/spec/requests/api/graphql/project/merge_request_spec.rb index 74820d39102..70c21666799 100644 --- a/spec/requests/api/graphql/project/merge_request_spec.rb +++ b/spec/requests/api/graphql/project/merge_request_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'getting merge request information nested in a project' do diff --git a/spec/requests/api/graphql/project_query_spec.rb b/spec/requests/api/graphql/project_query_spec.rb index 0727ada4691..fbb22958d51 100644 --- a/spec/requests/api/graphql/project_query_spec.rb +++ b/spec/requests/api/graphql/project_query_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'getting project information' do diff --git a/spec/requests/api/group_boards_spec.rb b/spec/requests/api/group_boards_spec.rb index b400a7f55ef..232ec9aca32 100644 --- a/spec/requests/api/group_boards_spec.rb +++ b/spec/requests/api/group_boards_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::GroupBoards do diff --git a/spec/requests/api/group_milestones_spec.rb b/spec/requests/api/group_milestones_spec.rb index 6980eb7f55d..3e9b6246434 100644 --- a/spec/requests/api/group_milestones_spec.rb +++ b/spec/requests/api/group_milestones_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::GroupMilestones do diff --git a/spec/requests/api/group_variables_spec.rb b/spec/requests/api/group_variables_spec.rb index d50bae3dc47..abdc3a40360 100644 --- a/spec/requests/api/group_variables_spec.rb +++ b/spec/requests/api/group_variables_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::GroupVariables do diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 902a5ec2a86..cb97398805a 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Groups do diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb index a1a007811fe..bbfe40041a1 100644 --- a/spec/requests/api/helpers_spec.rb +++ b/spec/requests/api/helpers_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'raven/transports/dummy' require_relative '../../../config/initializers/sentry' diff --git a/spec/requests/api/import_github_spec.rb b/spec/requests/api/import_github_spec.rb index 68df02d4d8d..3ff7102479c 100644 --- a/spec/requests/api/import_github_spec.rb +++ b/spec/requests/api/import_github_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ImportGithub do diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb index 02d1e4bf2f1..fcff2cde730 100644 --- a/spec/requests/api/internal/base_spec.rb +++ b/spec/requests/api/internal/base_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Internal::Base do diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb index 760bacff75e..020e7659a4c 100644 --- a/spec/requests/api/jobs_spec.rb +++ b/spec/requests/api/jobs_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Jobs do diff --git a/spec/requests/api/keys_spec.rb b/spec/requests/api/keys_spec.rb index f37d84fddef..6802a0cfdab 100644 --- a/spec/requests/api/keys_spec.rb +++ b/spec/requests/api/keys_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Keys do diff --git a/spec/requests/api/labels_spec.rb b/spec/requests/api/labels_spec.rb index 7089da3d351..d027738c8db 100644 --- a/spec/requests/api/labels_spec.rb +++ b/spec/requests/api/labels_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Labels do diff --git a/spec/requests/api/lint_spec.rb b/spec/requests/api/lint_spec.rb index f52cdf1c459..46d23bd16b9 100644 --- a/spec/requests/api/lint_spec.rb +++ b/spec/requests/api/lint_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Lint do diff --git a/spec/requests/api/markdown_spec.rb b/spec/requests/api/markdown_spec.rb index 0cf5c5677b9..99263f2fc1e 100644 --- a/spec/requests/api/markdown_spec.rb +++ b/spec/requests/api/markdown_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "spec_helper" describe API::Markdown do diff --git a/spec/requests/api/members_spec.rb b/spec/requests/api/members_spec.rb index eb55d747179..5c9e5746683 100644 --- a/spec/requests/api/members_spec.rb +++ b/spec/requests/api/members_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Members do @@ -24,7 +26,7 @@ describe API::Members do shared_examples 'GET /:source_type/:id/members/(all)' do |source_type, all| let(:members_url) do - "/#{source_type.pluralize}/#{source.id}/members".tap do |url| + (+"/#{source_type.pluralize}/#{source.id}/members").tap do |url| url << "/all" if all end end diff --git a/spec/requests/api/merge_request_diffs_spec.rb b/spec/requests/api/merge_request_diffs_spec.rb index 8a67d98fc4c..9de76c2fe50 100644 --- a/spec/requests/api/merge_request_diffs_spec.rb +++ b/spec/requests/api/merge_request_diffs_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "spec_helper" describe API::MergeRequestDiffs, 'MergeRequestDiffs' do diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 443682cd34c..8063004549e 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "spec_helper" describe API::MergeRequests do diff --git a/spec/requests/api/namespaces_spec.rb b/spec/requests/api/namespaces_spec.rb index 2e376109b42..e0bf1509be3 100644 --- a/spec/requests/api/namespaces_spec.rb +++ b/spec/requests/api/namespaces_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Namespaces do diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index 6c1e30791d2..e57d7699892 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Notes do diff --git a/spec/requests/api/notification_settings_spec.rb b/spec/requests/api/notification_settings_spec.rb index 4ed667ad0dc..09fc0197c58 100644 --- a/spec/requests/api/notification_settings_spec.rb +++ b/spec/requests/api/notification_settings_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::NotificationSettings do diff --git a/spec/requests/api/oauth_tokens_spec.rb b/spec/requests/api/oauth_tokens_spec.rb index 3811ec751de..8d7b3fa3c09 100644 --- a/spec/requests/api/oauth_tokens_spec.rb +++ b/spec/requests/api/oauth_tokens_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'OAuth tokens' do diff --git a/spec/requests/api/pages/internal_access_spec.rb b/spec/requests/api/pages/internal_access_spec.rb index 28abe1a8456..821a210a414 100644 --- a/spec/requests/api/pages/internal_access_spec.rb +++ b/spec/requests/api/pages/internal_access_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe "Internal Project Pages Access" do diff --git a/spec/requests/api/pages/private_access_spec.rb b/spec/requests/api/pages/private_access_spec.rb index 6af441caf74..ec84762b05a 100644 --- a/spec/requests/api/pages/private_access_spec.rb +++ b/spec/requests/api/pages/private_access_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe "Private Project Pages Access" do diff --git a/spec/requests/api/pages/public_access_spec.rb b/spec/requests/api/pages/public_access_spec.rb index d99224eca5b..67b8cfb8fbc 100644 --- a/spec/requests/api/pages/public_access_spec.rb +++ b/spec/requests/api/pages/public_access_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe "Public Project Pages Access" do diff --git a/spec/requests/api/pages_domains_spec.rb b/spec/requests/api/pages_domains_spec.rb index 326b724666d..ee3ee9c4d23 100644 --- a/spec/requests/api/pages_domains_spec.rb +++ b/spec/requests/api/pages_domains_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::PagesDomains do diff --git a/spec/requests/api/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index 072bd02f2ac..5c8ccce2e37 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::PipelineSchedules do diff --git a/spec/requests/api/project_container_repositories_spec.rb b/spec/requests/api/project_container_repositories_spec.rb index 3ac7ff7656b..66fb3c6b2d6 100644 --- a/spec/requests/api/project_container_repositories_spec.rb +++ b/spec/requests/api/project_container_repositories_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProjectContainerRepositories do diff --git a/spec/requests/api/project_events_spec.rb b/spec/requests/api/project_events_spec.rb index 8c2db6e4c62..d466dca9884 100644 --- a/spec/requests/api/project_events_spec.rb +++ b/spec/requests/api/project_events_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProjectEvents do diff --git a/spec/requests/api/project_export_spec.rb b/spec/requests/api/project_export_spec.rb index 4f1003efafe..605ff888234 100644 --- a/spec/requests/api/project_export_spec.rb +++ b/spec/requests/api/project_export_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProjectExport do diff --git a/spec/requests/api/project_hooks_spec.rb b/spec/requests/api/project_hooks_spec.rb index b88a8b95201..06c09b100ac 100644 --- a/spec/requests/api/project_hooks_spec.rb +++ b/spec/requests/api/project_hooks_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProjectHooks, 'ProjectHooks' do diff --git a/spec/requests/api/project_import_spec.rb b/spec/requests/api/project_import_spec.rb index 579d1a36c22..866adbd424e 100644 --- a/spec/requests/api/project_import_spec.rb +++ b/spec/requests/api/project_import_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProjectImport do diff --git a/spec/requests/api/project_milestones_spec.rb b/spec/requests/api/project_milestones_spec.rb index 895f05a98e8..df6d83c1e65 100644 --- a/spec/requests/api/project_milestones_spec.rb +++ b/spec/requests/api/project_milestones_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProjectMilestones do diff --git a/spec/requests/api/project_snapshots_spec.rb b/spec/requests/api/project_snapshots_spec.rb index 2857715cdbe..cdd44f71649 100644 --- a/spec/requests/api/project_snapshots_spec.rb +++ b/spec/requests/api/project_snapshots_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProjectSnapshots do diff --git a/spec/requests/api/project_snippets_spec.rb b/spec/requests/api/project_snippets_spec.rb index ef0cabad4b0..cac3f07d0d0 100644 --- a/spec/requests/api/project_snippets_spec.rb +++ b/spec/requests/api/project_snippets_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProjectSnippets do diff --git a/spec/requests/api/project_templates_spec.rb b/spec/requests/api/project_templates_spec.rb index 80e5033dab4..2bf864afe87 100644 --- a/spec/requests/api/project_templates_spec.rb +++ b/spec/requests/api/project_templates_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProjectTemplates do diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 0e343210f5e..585bf57fa4c 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' shared_examples 'languages and percentages JSON response' do diff --git a/spec/requests/api/protected_branches_spec.rb b/spec/requests/api/protected_branches_spec.rb index f90558d77a9..67ce704b3f3 100644 --- a/spec/requests/api/protected_branches_spec.rb +++ b/spec/requests/api/protected_branches_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProtectedBranches do diff --git a/spec/requests/api/protected_tags_spec.rb b/spec/requests/api/protected_tags_spec.rb index 41363dcc1c3..5a962cd5667 100644 --- a/spec/requests/api/protected_tags_spec.rb +++ b/spec/requests/api/protected_tags_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::ProtectedTags do diff --git a/spec/requests/api/releases_spec.rb b/spec/requests/api/releases_spec.rb index 99d0ceee76b..bf05587fe03 100644 --- a/spec/requests/api/releases_spec.rb +++ b/spec/requests/api/releases_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Releases do diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb index 6f4bb525c89..ba301147d43 100644 --- a/spec/requests/api/repositories_spec.rb +++ b/spec/requests/api/repositories_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'mime/types' diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index 70a95663aea..342d8905abc 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Runner, :clean_gitlab_redis_shared_state do diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index d26fbee6957..8daba204d50 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Runners do diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb index 0d8130f5e49..24d7f1e313c 100644 --- a/spec/requests/api/search_spec.rb +++ b/spec/requests/api/search_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Search do diff --git a/spec/requests/api/services_spec.rb b/spec/requests/api/services_spec.rb index 7153fcc99d7..8cf888d81ce 100644 --- a/spec/requests/api/services_spec.rb +++ b/spec/requests/api/services_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "spec_helper" describe API::Services do diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb index ffaa29fd924..0f1aa9bb2bb 100644 --- a/spec/requests/api/settings_spec.rb +++ b/spec/requests/api/settings_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Settings, 'Settings' do diff --git a/spec/requests/api/sidekiq_metrics_spec.rb b/spec/requests/api/sidekiq_metrics_spec.rb index fff9adb7f57..d6f0f48d288 100644 --- a/spec/requests/api/sidekiq_metrics_spec.rb +++ b/spec/requests/api/sidekiq_metrics_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::SidekiqMetrics do diff --git a/spec/requests/api/snippets_spec.rb b/spec/requests/api/snippets_spec.rb index e7eaaea2418..36d2a0d7ea7 100644 --- a/spec/requests/api/snippets_spec.rb +++ b/spec/requests/api/snippets_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Snippets do diff --git a/spec/requests/api/system_hooks_spec.rb b/spec/requests/api/system_hooks_spec.rb index 0e2f3face71..79790b1e999 100644 --- a/spec/requests/api/system_hooks_spec.rb +++ b/spec/requests/api/system_hooks_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::SystemHooks do diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb index c4f4a2cb889..3c6ec631664 100644 --- a/spec/requests/api/tags_spec.rb +++ b/spec/requests/api/tags_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Tags do diff --git a/spec/requests/api/templates_spec.rb b/spec/requests/api/templates_spec.rb index d1e16ab9ca9..b6ba417d892 100644 --- a/spec/requests/api/templates_spec.rb +++ b/spec/requests/api/templates_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Templates do diff --git a/spec/requests/api/todos_spec.rb b/spec/requests/api/todos_spec.rb index 9f0d5ad5d12..4121a0f3f3a 100644 --- a/spec/requests/api/todos_spec.rb +++ b/spec/requests/api/todos_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Todos do diff --git a/spec/requests/api/triggers_spec.rb b/spec/requests/api/triggers_spec.rb index 8ea3d16a41f..fd1104fa978 100644 --- a/spec/requests/api/triggers_spec.rb +++ b/spec/requests/api/triggers_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Triggers do diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 50e82ca5481..d9bcbffa844 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Users do diff --git a/spec/requests/api/variables_spec.rb b/spec/requests/api/variables_spec.rb index 69f105b71a8..dfecd43cbfa 100644 --- a/spec/requests/api/variables_spec.rb +++ b/spec/requests/api/variables_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Variables do diff --git a/spec/requests/api/version_spec.rb b/spec/requests/api/version_spec.rb index e06f8bbc095..e2117ca45ee 100644 --- a/spec/requests/api/version_spec.rb +++ b/spec/requests/api/version_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Version do diff --git a/spec/requests/api/wikis_spec.rb b/spec/requests/api/wikis_spec.rb index 97de26650db..310caa92eb9 100644 --- a/spec/requests/api/wikis_spec.rb +++ b/spec/requests/api/wikis_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' # For every API endpoint we test 3 states of wikis: diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb index 67c8056becb..f0849e94ee8 100644 --- a/spec/requests/git_http_spec.rb +++ b/spec/requests/git_http_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Git HTTP requests' do diff --git a/spec/requests/groups/milestones_controller_spec.rb b/spec/requests/groups/milestones_controller_spec.rb index af19d931284..977cccad29f 100644 --- a/spec/requests/groups/milestones_controller_spec.rb +++ b/spec/requests/groups/milestones_controller_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Groups::MilestonesController do diff --git a/spec/requests/jwt_controller_spec.rb b/spec/requests/jwt_controller_spec.rb index 8b2c698fee1..c1f99115612 100644 --- a/spec/requests/jwt_controller_spec.rb +++ b/spec/requests/jwt_controller_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe JwtController do diff --git a/spec/requests/lfs_locks_api_spec.rb b/spec/requests/lfs_locks_api_spec.rb index 11436e5cd0c..41f54162266 100644 --- a/spec/requests/lfs_locks_api_spec.rb +++ b/spec/requests/lfs_locks_api_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Git LFS File Locking API' do diff --git a/spec/requests/oauth_tokens_spec.rb b/spec/requests/oauth_tokens_spec.rb index 3873e754060..bb1c25d686e 100644 --- a/spec/requests/oauth_tokens_spec.rb +++ b/spec/requests/oauth_tokens_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'OAuth Tokens requests' do diff --git a/spec/requests/openid_connect_spec.rb b/spec/requests/openid_connect_spec.rb index dfa17c5ff27..bac1a4e18c8 100644 --- a/spec/requests/openid_connect_spec.rb +++ b/spec/requests/openid_connect_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'OpenID Connect requests' do diff --git a/spec/requests/projects/cycle_analytics_events_spec.rb b/spec/requests/projects/cycle_analytics_events_spec.rb index afbc5835f02..93a1aafde23 100644 --- a/spec/requests/projects/cycle_analytics_events_spec.rb +++ b/spec/requests/projects/cycle_analytics_events_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cycle analytics events' do diff --git a/spec/requests/rack_attack_global_spec.rb b/spec/requests/rack_attack_global_spec.rb index ca8720cd414..e6e2f9bf92e 100644 --- a/spec/requests/rack_attack_global_spec.rb +++ b/spec/requests/rack_attack_global_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Rack Attack global throttles' do diff --git a/spec/requests/request_profiler_spec.rb b/spec/requests/request_profiler_spec.rb index 851affbcf88..36ccfc6b400 100644 --- a/spec/requests/request_profiler_spec.rb +++ b/spec/requests/request_profiler_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Request Profiler' do diff --git a/spec/support/shared_examples/updating_mentions_shared_examples.rb b/spec/support/shared_examples/updating_mentions_shared_examples.rb index 3295ab72987..84f6c4d136a 100644 --- a/spec/support/shared_examples/updating_mentions_shared_examples.rb +++ b/spec/support/shared_examples/updating_mentions_shared_examples.rb @@ -58,9 +58,25 @@ RSpec.shared_examples 'updating mentions' do |service_class| end end + shared_examples 'updating attribute with existing group mention' do |attribute| + before do + mentionable.update!({ attribute => "FYI: #{group.to_reference}" }) + end + + it 'creates todos for only newly mentioned users' do + expect do + update_mentionable( + { attribute => "For #{group.to_reference}, cc: #{mentioned_user.to_reference}" } + ) + end.to change { Todo.count }.by(1) + end + end + context 'when group is public' do it_behaves_like 'updating attribute with allowed mentions', :title it_behaves_like 'updating attribute with allowed mentions', :description + it_behaves_like 'updating attribute with existing group mention', :title + it_behaves_like 'updating attribute with existing group mention', :description end context 'when the group is private' do @@ -70,6 +86,8 @@ RSpec.shared_examples 'updating mentions' do |service_class| it_behaves_like 'updating attribute with allowed mentions', :title it_behaves_like 'updating attribute with allowed mentions', :description + it_behaves_like 'updating attribute with existing group mention', :title + it_behaves_like 'updating attribute with existing group mention', :description end end diff --git a/spec/views/projects/clusters/clusters/gcp/_form.html.haml_spec.rb b/spec/views/projects/clusters/clusters/gcp/_form.html.haml_spec.rb new file mode 100644 index 00000000000..1cb2f9a4301 --- /dev/null +++ b/spec/views/projects/clusters/clusters/gcp/_form.html.haml_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'clusters/clusters/gcp/_form' do + let(:admin) { create(:admin) } + let(:environment) { create(:environment) } + let(:gcp_cluster) { create(:cluster, :provided_by_gcp) } + let(:clusterable) { ClusterablePresenter.fabricate(environment.project, current_user: admin) } + + before do + assign(:environment, environment) + assign(:gcp_cluster, gcp_cluster) + allow(view).to receive(:clusterable).and_return(clusterable) + allow(view).to receive(:url_for).and_return('#') + allow(view).to receive(:token_in_session).and_return('') + end + + context 'with all feature flags enabled' do + it 'has a cloud run checkbox' do + render + + expect(rendered).to have_selector("input[id='cluster_provider_gcp_attributes_cloud_run']") + end + end + + context 'with cloud run feature flag disabled' do + before do + stub_feature_flags(create_cloud_run_clusters: false) + end + + it 'does not have a cloud run checkbox' do + render + + expect(rendered).not_to have_selector("input[id='cluster_provider_gcp_attributes_cloud_run']") + end + end +end |