diff options
-rw-r--r-- | .haml-lint.yml | 1 | ||||
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 4 | ||||
-rw-r--r-- | app/models/user.rb | 1 | ||||
-rw-r--r-- | app/views/admin/deploy_keys/new.html.haml | 2 | ||||
-rw-r--r-- | app/views/devise/unlocks/new.html.haml | 6 | ||||
-rw-r--r-- | changelogs/unreleased/Externalise-strings-in-unlocks-new-html-haml.yml | 5 | ||||
-rw-r--r-- | changelogs/unreleased/Externalize-strings-in-deploy_keys-new-html-haml.yml | 5 | ||||
-rw-r--r-- | changelogs/unreleased/confirm_support_bot.yml | 5 | ||||
-rw-r--r-- | changelogs/unreleased/id-bump-rspec-rails.yml | 5 | ||||
-rw-r--r-- | changelogs/unreleased/lm-enable-ff-by-default.yml | 5 | ||||
-rw-r--r-- | config/feature_flags/development/multiple_cache_per_job.yml | 2 | ||||
-rw-r--r-- | db/post_migrate/20210407150240_confirm_support_bot_user.rb | 23 | ||||
-rw-r--r-- | db/schema_migrations/20210407150240 | 1 | ||||
-rw-r--r-- | doc/api/openapi/openapi_interactive.md | 18 | ||||
-rw-r--r-- | doc/ci/yaml/README.md | 18 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/cache.rb | 4 | ||||
-rw-r--r-- | locale/gitlab.pot | 6 | ||||
-rw-r--r-- | spec/migrations/confirm_support_bot_user_spec.rb | 86 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 6 |
20 files changed, 179 insertions, 26 deletions
diff --git a/.haml-lint.yml b/.haml-lint.yml index cb0991e6575..39090a48d1c 100644 --- a/.haml-lint.yml +++ b/.haml-lint.yml @@ -104,7 +104,6 @@ linters: # These cops should eventually get enabled - Cop/LineBreakAfterGuardClauses - - Cop/LineBreakAroundConditionalBlock - Cop/ProjectPathHelper - Gitlab/FeatureAvailableUsage - GitlabSecurity/PublicSend @@ -366,7 +366,7 @@ group :development, :test do gem 'database_cleaner', '~> 1.7.0' gem 'factory_bot_rails', '~> 6.1.0' - gem 'rspec-rails', '~> 4.0.2' + gem 'rspec-rails', '~> 4.1.2' # Prevent occasions where minitest is not bundled in packaged versions of ruby (see #3826) gem 'minitest', '~> 5.11.0' diff --git a/Gemfile.lock b/Gemfile.lock index fe836915448..246e52650ce 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1075,7 +1075,7 @@ GEM proc_to_ast rspec (>= 2.13, < 4) unparser - rspec-rails (4.0.2) + rspec-rails (4.1.2) actionpack (>= 4.2) activesupport (>= 4.2) railties (>= 4.2) @@ -1563,7 +1563,7 @@ DEPENDENCIES rouge (~> 3.26.0) rqrcode-rails3 (~> 0.1.7) rspec-parameterized - rspec-rails (~> 4.0.2) + rspec-rails (~> 4.1.2) rspec-retry (~> 0.6.1) rspec_junit_formatter rspec_profiling (~> 0.0.6) diff --git a/app/models/user.rb b/app/models/user.rb index a1035168dba..426309762ca 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -764,6 +764,7 @@ class User < ApplicationRecord u.bio = 'The GitLab support bot used for Service Desk' u.name = 'GitLab Support Bot' u.avatar = bot_avatar(image: 'support-bot.png') + u.confirmed_at = Time.zone.now end end diff --git a/app/views/admin/deploy_keys/new.html.haml b/app/views/admin/deploy_keys/new.html.haml index dc49db6557b..0eaf7b60b25 100644 --- a/app/views/admin/deploy_keys/new.html.haml +++ b/app/views/admin/deploy_keys/new.html.haml @@ -1,5 +1,5 @@ - page_title _('New Deploy Key') -%h3.page-title New public deploy key +%h3.page-title= _('New public deploy key') %hr %div diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml index 398a4fa0c5e..abaf169afd5 100644 --- a/app/views/devise/unlocks/new.html.haml +++ b/app/views/devise/unlocks/new.html.haml @@ -1,4 +1,4 @@ -= render 'devise/shared/tab_single', tab_title: 'Resend unlock instructions' += render 'devise/shared/tab_single', tab_title: _('Resend unlock instructions') .login-box .login-body = form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post, class: 'gl-show-field-errors' }) do |f| @@ -6,9 +6,9 @@ = render "devise/shared/error_messages", resource: resource .form-group.gl-mb-6 = f.label :email - = f.email_field :email, class: 'form-control', autofocus: 'autofocus', autocapitalize: 'off', autocorrect: 'off', title: 'Please provide a valid email address.' + = f.email_field :email, class: 'form-control', autofocus: 'autofocus', autocapitalize: 'off', autocorrect: 'off', title: _('Please provide a valid email address.') .clearfix - = f.submit 'Resend unlock instructions', class: 'gl-button btn btn-confirm' + = f.submit _('Resend unlock instructions'), class: 'gl-button btn btn-confirm' .clearfix.prepend-top-20 = render 'devise/shared/sign_in_link' diff --git a/changelogs/unreleased/Externalise-strings-in-unlocks-new-html-haml.yml b/changelogs/unreleased/Externalise-strings-in-unlocks-new-html-haml.yml new file mode 100644 index 00000000000..d1de0b08aff --- /dev/null +++ b/changelogs/unreleased/Externalise-strings-in-unlocks-new-html-haml.yml @@ -0,0 +1,5 @@ +--- +title: Externalize strings in unlocks/new.html.haml +merge_request: 58289 +author: nuwe1 +type: other diff --git a/changelogs/unreleased/Externalize-strings-in-deploy_keys-new-html-haml.yml b/changelogs/unreleased/Externalize-strings-in-deploy_keys-new-html-haml.yml new file mode 100644 index 00000000000..7c25d35e5fb --- /dev/null +++ b/changelogs/unreleased/Externalize-strings-in-deploy_keys-new-html-haml.yml @@ -0,0 +1,5 @@ +--- +title: Externalize strings in deploy_keys/new.html.haml +merge_request: 58148 +author: nuwe1 +type: other diff --git a/changelogs/unreleased/confirm_support_bot.yml b/changelogs/unreleased/confirm_support_bot.yml new file mode 100644 index 00000000000..a37b245c8ab --- /dev/null +++ b/changelogs/unreleased/confirm_support_bot.yml @@ -0,0 +1,5 @@ +--- +title: Fix notification when new Service Desk Issue is created +merge_request: 58803 +author: +type: fixed diff --git a/changelogs/unreleased/id-bump-rspec-rails.yml b/changelogs/unreleased/id-bump-rspec-rails.yml new file mode 100644 index 00000000000..50806bb019e --- /dev/null +++ b/changelogs/unreleased/id-bump-rspec-rails.yml @@ -0,0 +1,5 @@ +--- +title: Bump rspec-rails to 4.1.2 +merge_request: 59130 +author: +type: other diff --git a/changelogs/unreleased/lm-enable-ff-by-default.yml b/changelogs/unreleased/lm-enable-ff-by-default.yml new file mode 100644 index 00000000000..52b69275255 --- /dev/null +++ b/changelogs/unreleased/lm-enable-ff-by-default.yml @@ -0,0 +1,5 @@ +--- +title: Enables multiple_cache_per_job feature flag by default +merge_request: 59016 +author: +type: added diff --git a/config/feature_flags/development/multiple_cache_per_job.yml b/config/feature_flags/development/multiple_cache_per_job.yml index d06fc7a6f89..f65354cce2c 100644 --- a/config/feature_flags/development/multiple_cache_per_job.yml +++ b/config/feature_flags/development/multiple_cache_per_job.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/321877 milestone: '13.10' type: development group: group::pipeline authoring -default_enabled: false +default_enabled: true diff --git a/db/post_migrate/20210407150240_confirm_support_bot_user.rb b/db/post_migrate/20210407150240_confirm_support_bot_user.rb new file mode 100644 index 00000000000..c26ae153128 --- /dev/null +++ b/db/post_migrate/20210407150240_confirm_support_bot_user.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class ConfirmSupportBotUser < ActiveRecord::Migration[6.0] + SUPPORT_BOT_TYPE = 1 + + def up + users = Arel::Table.new(:users) + um = Arel::UpdateManager.new + um.table(users) + .where(users[:user_type].eq(SUPPORT_BOT_TYPE)) + .where(users[:confirmed_at].eq(nil)) + .set([[users[:confirmed_at], Arel::Nodes::NamedFunction.new('COALESCE', [users[:created_at], Arel::Nodes::SqlLiteral.new('NOW()')])]]) + connection.execute(um.to_sql) + end + + def down + # no op + + # The up migration allows for the possibility that the support user might + # have already been manually confirmed. It's not reversible as this data is + # subsequently lost. + end +end diff --git a/db/schema_migrations/20210407150240 b/db/schema_migrations/20210407150240 new file mode 100644 index 00000000000..cfc187d5dd7 --- /dev/null +++ b/db/schema_migrations/20210407150240 @@ -0,0 +1 @@ +b5f83e3870dc7c70fbde6071725aa2acb3e99f7c2ed050633c34ed35e696ba1e
\ No newline at end of file diff --git a/doc/api/openapi/openapi_interactive.md b/doc/api/openapi/openapi_interactive.md index 95d7bba8081..e34b003e32c 100644 --- a/doc/api/openapi/openapi_interactive.md +++ b/doc/api/openapi/openapi_interactive.md @@ -10,19 +10,27 @@ Introduces the interactive documentation tool for the GitLab API. ## About the OpenAPI specification -The [OpenAPI specification](https://swagger.io/specification/) (formerly called Swagger) defines a standard, language-agnostic interface to RESTful APIs. OpenAPI definition files are written in the YAML format, which is automatically rendered by the GitLab browser into a more human-readable interface. For general information about the GitLab APIs, see [API Docs](../README.md). +The [OpenAPI specification](https://swagger.io/specification/) (formerly called Swagger) defines a +standard, language-agnostic interface to RESTful APIs. OpenAPI definition files are written in the +YAML format, which is automatically rendered by the GitLab browser into a more human-readable interface. + +For general information about the GitLab APIs, see [API Docs](../README.md). ## Overview -The [interactive API documentation tool](openapi.yaml) allows API testing directly on the GitLab.com -website. Only a few of the available endpoints are documented with the OpenAPI spec, but the current -list demonstrates the functionality of the tool. +<!-- +The following link is absolute rather than relative because it needs to be viewed through the GitLab +Open API file viewer: https://docs.gitlab.com/ee/user/project/repository/index.html#openapi-viewer. +--> +The [interactive API documentation tool](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/api/openapi/openapi.yaml) +allows API testing directly on the GitLab.com website. Only a few of the available endpoints are +documented with the OpenAPI spec, but the current list demonstrates the functionality of the tool. ![API viewer screenshot](img/apiviewer01-fs8.png) ## Endpoint parameters -When you expand an endpoint listing, you'll see a description, input parameters (if required), +When you expand an endpoint listing, you see a description, input parameters (if required), and example server responses. Some parameters include a default or a list of allowed values. ![API viewer screenshot](img/apiviewer04-fs8.png) diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 8313c7e05e2..9ffb2f5de9f 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -2918,13 +2918,11 @@ You can specify a [fallback cache key](#fallback-cache-key) to use if the specif ##### Multiple caches > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32814) in GitLab 13.10. -> - It's [deployed behind a feature flag](../../user/feature_flags.md), disabled by default. -> - It's disabled on GitLab.com. -> - It's not recommended for production use. -> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-multiple-caches). **(FREE SELF)** - -WARNING: -This feature might not be available to you. Check the **version history** note above for details. +> - [Deployed behind a feature flag](../../user/feature_flags.md), disabled by default. +> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/321877) in GitLab 13.11. +> - Enabled on GitLab.com. +> - Recommended for production use. +> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-multiple-caches). **(FREE SELF)** You can have a maximum of four caches: @@ -2953,10 +2951,10 @@ the fallback is fetched multiple times if multiple caches are not found. ##### Enable or disable multiple caches **(FREE SELF)** -The multiple caches feature is under development and not ready for production use. -It is deployed behind a feature flag that is **disabled by default**. +The multiple caches feature is under development but ready for production use. +It is deployed behind a feature flag that is **enabled by default**. [GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md) -can enable it. +can opt to disable it. To enable it: diff --git a/lib/gitlab/ci/config/entry/cache.rb b/lib/gitlab/ci/config/entry/cache.rb index cdf1f3c5280..f9688c500d2 100644 --- a/lib/gitlab/ci/config/entry/cache.rb +++ b/lib/gitlab/ci/config/entry/cache.rb @@ -8,8 +8,8 @@ module Gitlab # Entry that represents a cache configuration # class Cache < ::Gitlab::Config::Entry::Simplifiable - strategy :Caches, if: -> (config) { Feature.enabled?(:multiple_cache_per_job) } - strategy :Cache, if: -> (config) { Feature.disabled?(:multiple_cache_per_job) } + strategy :Caches, if: -> (config) { Feature.enabled?(:multiple_cache_per_job, default_enabled: :yaml) } + strategy :Cache, if: -> (config) { Feature.disabled?(:multiple_cache_per_job, default_enabled: :yaml) } class Caches < ::Gitlab::Config::Entry::ComposableArray include ::Gitlab::Config::Entry::Validatable diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 27d4d4f33bd..cdfe2329d02 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -21086,6 +21086,9 @@ msgstr "" msgid "New project/repository" msgstr "" +msgid "New public deploy key" +msgstr "" + msgid "New release" msgstr "" @@ -26698,6 +26701,9 @@ msgstr "" msgid "Resend it" msgstr "" +msgid "Resend unlock instructions" +msgstr "" + msgid "Reset" msgstr "" diff --git a/spec/migrations/confirm_support_bot_user_spec.rb b/spec/migrations/confirm_support_bot_user_spec.rb new file mode 100644 index 00000000000..f6bcab4aa7d --- /dev/null +++ b/spec/migrations/confirm_support_bot_user_spec.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe ConfirmSupportBotUser, :migration do + let(:users) { table(:users) } + + context 'when support bot user is currently unconfirmed' do + let!(:support_bot) do + create_user!( + created_at: 2.days.ago, + user_type: User::USER_TYPES['support_bot'] + ) + end + + it 'updates the `confirmed_at` attribute' do + expect { migrate! }.to change { support_bot.reload.confirmed_at } + end + + it 'sets `confirmed_at` to be the same as their `created_at` attribute' do + migrate! + + expect(support_bot.reload.confirmed_at).to eq(support_bot.created_at) + end + end + + context 'when support bot user is already confirmed' do + let!(:confirmed_support_bot) do + create_user!( + user_type: User::USER_TYPES['support_bot'], + confirmed_at: 1.day.ago + ) + end + + it 'does not change their `confirmed_at` attribute' do + expect { migrate! }.not_to change { confirmed_support_bot.reload.confirmed_at } + end + end + + context 'when support bot user created_at is null' do + let!(:support_bot) do + create_user!( + user_type: User::USER_TYPES['support_bot'], + confirmed_at: nil, + record_timestamps: false + ) + end + + it 'updates the `confirmed_at` attribute' do + expect { migrate! }.to change { support_bot.reload.confirmed_at }.from(nil) + end + + it 'does not change the `created_at` attribute' do + expect { migrate!}.not_to change { support_bot.reload.created_at }.from(nil) + end + end + + context 'with human users that are currently unconfirmed' do + let!(:unconfirmed_human) do + create_user!( + name: 'human', + email: 'human@example.com', + user_type: nil + ) + end + + it 'does not update their `confirmed_at` attribute' do + expect { migrate! }.not_to change { unconfirmed_human.reload.confirmed_at } + end + end + + private + + def create_user!(name: 'GitLab Support Bot', email: 'support@example.com', user_type:, created_at: Time.now, confirmed_at: nil, record_timestamps: true) + users.create!( + name: name, + email: email, + username: name, + projects_limit: 0, + user_type: user_type, + confirmed_at: confirmed_at, + record_timestamps: record_timestamps + ) + end +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 7c01ef5e53e..468e0066362 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -5508,6 +5508,12 @@ RSpec.describe User do it_behaves_like 'bot user avatars', :alert_bot, 'alert-bot.png' it_behaves_like 'bot user avatars', :support_bot, 'support-bot.png' it_behaves_like 'bot user avatars', :security_bot, 'security-bot.png' + + context 'when bot is the support_bot' do + subject { described_class.support_bot } + + it { is_expected.to be_confirmed } + end end describe '#confirmation_required_on_sign_in?' do |