diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-18 15:07:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-18 15:07:46 +0300 |
commit | 57834f3eb0c043602f1312845f4d5baf9f39a226 (patch) | |
tree | ce4df60751983ba48dfe21c81d35d26ed96a6e9d | |
parent | 1876696e875fa9de7e6344d760ac411057e628f5 (diff) |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | app/controllers/jira_connect/application_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/jira_connect/subscriptions_controller.rb | 2 | ||||
-rw-r--r-- | config/initializers/1_active_record_data_types.rb (renamed from config/initializers/active_record_data_types.rb) | 7 | ||||
-rw-r--r-- | config/routes.rb | 1 | ||||
-rw-r--r-- | locale/gitlab.pot | 12 | ||||
-rw-r--r-- | spec/requests/jira_connect/cors_preflight_checks_controller_spec.rb | 7 | ||||
-rw-r--r-- | spec/requests/jira_connect/subscriptions_controller_spec.rb | 12 |
7 files changed, 33 insertions, 9 deletions
diff --git a/app/controllers/jira_connect/application_controller.rb b/app/controllers/jira_connect/application_controller.rb index b9f0ea795e1..9e55aace783 100644 --- a/app/controllers/jira_connect/application_controller.rb +++ b/app/controllers/jira_connect/application_controller.rb @@ -5,6 +5,7 @@ class JiraConnect::ApplicationController < ApplicationController CORS_ALLOWED_METHODS = { '/-/jira_connect/oauth_application_id' => %i[GET OPTIONS], + '/-/jira_connect/subscriptions.json' => %i[GET OPTIONS], '/-/jira_connect/subscriptions/*' => %i[DELETE OPTIONS] }.freeze diff --git a/app/controllers/jira_connect/subscriptions_controller.rb b/app/controllers/jira_connect/subscriptions_controller.rb index 9a732cadd94..e4022b3ef46 100644 --- a/app/controllers/jira_connect/subscriptions_controller.rb +++ b/app/controllers/jira_connect/subscriptions_controller.rb @@ -23,11 +23,11 @@ class JiraConnect::SubscriptionsController < JiraConnect::ApplicationController push_frontend_feature_flag(:jira_connect_oauth_self_managed, @user) end + before_action :set_cors_headers before_action :allow_rendering_in_iframe, only: :index before_action :verify_qsh_claim!, only: :index before_action :allow_self_managed_content_security_policy, only: :index before_action :authenticate_user!, only: :create - before_action :set_cors_headers def index @subscriptions = current_jira_installation.subscriptions.preload_namespace_route diff --git a/config/initializers/active_record_data_types.rb b/config/initializers/1_active_record_data_types.rb index b57d3bb5df1..ba4ca8b3b5c 100644 --- a/config/initializers/active_record_data_types.rb +++ b/config/initializers/1_active_record_data_types.rb @@ -8,7 +8,7 @@ require 'active_record/connection_adapters/postgresql_adapter' ActiveRecord::Type.register(:ind_jsonb, Gitlab::Database::Type::IndifferentJsonb) ActiveRecord::Type.register(:sym_jsonb, Gitlab::Database::Type::SymbolizedJsonb) -module ActiveRecord::ConnectionAdapters::PostgreSQL::OID +module ActiveRecord::ConnectionAdapters::PostgreSQL::OID # rubocop:disable Style/ClassAndModuleChildren # Add the class `DateTimeWithTimeZone` so we can map `timestamptz` to it. class DateTimeWithTimeZone < DateTime def type @@ -37,7 +37,7 @@ module RegisterDateTimeWithTimeZone end end -class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter +class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter # rubocop:disable Style/ClassAndModuleChildren prepend RegisterDateTimeWithTimeZone # Add column type `datetime_with_timezone` so we can do this in @@ -55,6 +55,9 @@ rescue StandardError end # Ensure `datetime_with_timezone` columns are correctly written to schema.rb + +# rubocop:disable Database/MultipleDatabases ActiveRecord::Base.connection.send(:reload_type_map) if connection_active? ActiveRecord::Base.time_zone_aware_types += [:datetime_with_timezone] +# rubocop:enable Database/MultipleDatabases diff --git a/config/routes.rb b/config/routes.rb index 27313854233..e218099ec4a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -56,6 +56,7 @@ InitializerConnections.with_disabled_database_connections do match '/oauth/revoke' => 'oauth/tokens#revoke', via: :options match '/-/jira_connect/oauth_application_id' => 'jira_connect/cors_preflight_checks#index', via: :options + match '/-/jira_connect/subscriptions.json' => 'jira_connect/cors_preflight_checks#index', via: :options match '/-/jira_connect/subscriptions/:id' => 'jira_connect/cors_preflight_checks#index', via: :options match '/-/jira_connect/installations' => 'jira_connect/cors_preflight_checks#index', via: :options diff --git a/locale/gitlab.pot b/locale/gitlab.pot index e90175cf321..f0402ac0b0a 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -11403,6 +11403,9 @@ msgstr "" msgid "Create tag %{tagName}" msgstr "" +msgid "Create testing scenarios by defining project conditions in your development platform." +msgstr "" + msgid "Create topic" msgstr "" @@ -20788,6 +20791,9 @@ msgstr "" msgid "Improve customer support with Service Desk" msgstr "" +msgid "Improve quality with test cases" +msgstr "" + msgid "In case of pull mirroring, your user will be the author of all events in the activity feed that are the result of an update, like new branches being created or new commits being pushed to existing branches." msgstr "" @@ -46279,9 +46285,6 @@ msgstr "" msgid "With requirements, you can set criteria to check your products against." msgstr "" -msgid "With test cases, you can define conditions for your project to meet in determining quality" -msgstr "" - msgid "Withdraw Access Request" msgstr "" @@ -46805,9 +46808,6 @@ msgstr "" msgid "You can get started by cloning the repository or start adding files to it with one of the following options." msgstr "" -msgid "You can group test cases using labels. To learn about the future direction of this feature, visit %{linkStart}Quality Management direction page%{linkEnd}." -msgstr "" - msgid "You can invite a new member to %{project_name} or invite another group." msgstr "" diff --git a/spec/requests/jira_connect/cors_preflight_checks_controller_spec.rb b/spec/requests/jira_connect/cors_preflight_checks_controller_spec.rb index d441a8575d0..e356aaa3796 100644 --- a/spec/requests/jira_connect/cors_preflight_checks_controller_spec.rb +++ b/spec/requests/jira_connect/cors_preflight_checks_controller_spec.rb @@ -50,6 +50,13 @@ RSpec.describe JiraConnect::CorsPreflightChecksController do it_behaves_like 'allows cross-origin requests on self managed' end + describe 'OPTIONS /-/jira_connect/subscriptions.json' do + let(:allowed_methods) { 'GET, OPTIONS' } + let(:path) { '/-/jira_connect/subscriptions.json' } + + it_behaves_like 'allows cross-origin requests on self managed' + end + describe 'OPTIONS /-/jira_connect/subscriptions/:id' do let(:allowed_methods) { 'DELETE, OPTIONS' } let(:path) { '/-/jira_connect/subscriptions/123' } diff --git a/spec/requests/jira_connect/subscriptions_controller_spec.rb b/spec/requests/jira_connect/subscriptions_controller_spec.rb index b5f3ab916a4..06fac11fe1b 100644 --- a/spec/requests/jira_connect/subscriptions_controller_spec.rb +++ b/spec/requests/jira_connect/subscriptions_controller_spec.rb @@ -45,6 +45,18 @@ RSpec.describe JiraConnect::SubscriptionsController do it { is_expected.not_to include('http://self-managed-gitlab.com/api/') } it { is_expected.not_to include('http://self-managed-gitlab.com/oauth/') } end + + context 'when json format' do + let(:path) { '/-/jira_connect/subscriptions.json' } + + it 'allows cross-origin requests', :aggregate_failures do + get path, params: params, headers: cors_request_headers + + expect(response.headers['Access-Control-Allow-Origin']).to eq 'https://gitlab.com' + expect(response.headers['Access-Control-Allow-Methods']).to eq 'GET, OPTIONS' + expect(response.headers['Access-Control-Allow-Credentials']).to be_nil + end + end end describe 'DELETE /-/jira_connect/subscriptions/:id' do |