From e423096b77f37acb446ac36d2cf79eaf632b2628 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Wed, 21 Nov 2018 12:17:26 +0100 Subject: Explicitly set locale fallbacks With a recent change in i18n, default language is not included in fallbacks by default. This causes that MissingTranslationData exception is raised both in development and production mode. This patch sets explicitly fallbacks language to english which assures that english is used for missing translations. --- config/application.rb | 6 ++++++ config/environments/production.rb | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'config') diff --git a/config/application.rb b/config/application.rb index 921baa5d617..ca252179a38 100644 --- a/config/application.rb +++ b/config/application.rb @@ -66,6 +66,12 @@ module Gitlab # config.i18n.default_locale = :de config.i18n.enforce_available_locales = false + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found). + # We have to explicitly set default locale since 1.1.0 - see: + # https://github.com/svenfuchs/i18n/pull/415 + config.i18n.fallbacks = [:en] + # Translation for AR attrs is not working well for POROs like WikiPage config.gettext_i18n_rails.use_for_active_record_attributes = false diff --git a/config/environments/production.rb b/config/environments/production.rb index 71195164e7a..49a4e873093 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -65,10 +65,6 @@ Rails.application.configure do # Enable threaded mode # config.threadsafe! unless $rails_rake_task - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true - # Send deprecation notices to registered listeners config.active_support.deprecation = :notify -- cgit v1.2.3 From e902f462c213d1bb0cc56f298c7bef01befa0616 Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Mon, 19 Nov 2018 23:08:23 +0900 Subject: Eliminate duplicated words Signed-off-by: Takuya Noguchi --- config/boot.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config') diff --git a/config/boot.rb b/config/boot.rb index 1aeacdabbad..725473ac7f6 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -12,5 +12,5 @@ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) begin require 'bootsnap/setup' rescue LoadError - # bootsnap is optional dependency, so if we don't have it it's fine + # bootsnap is an optional dependency, so if we don't have it, it's fine end -- cgit v1.2.3 From 4c6073974c3889f26c99ebfb578a987e86328d7c Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Tue, 13 Nov 2018 09:45:10 +0100 Subject: Add version migration support to rails 4 When switching to rails 5, we added migration version to all migration classes. This patch makes it possible to run versioned migrations also with rails 4 --- config/application.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config') diff --git a/config/application.rb b/config/application.rb index 921baa5d617..796aa85e113 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,6 +26,9 @@ module Gitlab # setting disabled require_dependency Rails.root.join('lib/mysql_zero_date') + # This can be removed when we drop support for rails 4 + require_dependency Rails.root.join('lib/rails4_migration_version') + # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. -- cgit v1.2.3 From 1b8a791829a3c6226f5185f2433ddf632d2d945d Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 22 Nov 2018 17:28:09 +0100 Subject: Clear BatchLoader context between Sidekiq jobs --- config/initializers/sidekiq.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'config') diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 565efc858d1..4210be2c701 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -20,6 +20,7 @@ Sidekiq.configure_server do |config| chain.add Gitlab::SidekiqMiddleware::ArgumentsLogger if ENV['SIDEKIQ_LOG_ARGUMENTS'] && !enable_json_logs chain.add Gitlab::SidekiqMiddleware::Shutdown chain.add Gitlab::SidekiqMiddleware::RequestStoreMiddleware unless ENV['SIDEKIQ_REQUEST_STORE'] == '0' + chain.add Gitlab::SidekiqMiddleware::BatchLoader chain.add Gitlab::SidekiqStatus::ServerMiddleware end -- cgit v1.2.3 From ca52b32b4632bcd8d4ae10c082abf82ff2459b0d Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Tue, 27 Nov 2018 21:05:34 +1300 Subject: Remove monkeypatch as now present in upstream See https://github.com/abonas/kubeclient/blob/v4.0.0/lib/kubeclient/common.rb#L395 --- config/initializers/kubeclient.rb | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'config') diff --git a/config/initializers/kubeclient.rb b/config/initializers/kubeclient.rb index 2d9f439fdc0..f8fe1156aaa 100644 --- a/config/initializers/kubeclient.rb +++ b/config/initializers/kubeclient.rb @@ -1,19 +1,4 @@ class Kubeclient::Client - # We need to monkey patch this method until - # https://github.com/abonas/kubeclient/pull/323 is merged - def proxy_url(kind, name, port, namespace = '') - discover unless @discovered - entity_name_plural = - if %w[services pods nodes].include?(kind.to_s) - kind.to_s - else - @entities[kind.to_s].resource_name - end - - ns_prefix = build_namespace_prefix(namespace) - rest_client["#{ns_prefix}#{entity_name_plural}/#{name}:#{port}/proxy"].url - end - # Monkey patch to set `max_redirects: 0`, so that kubeclient # does not follow redirects and expose internal services. # See https://gitlab.com/gitlab-org/gitlab-ce/issues/53158 -- cgit v1.2.3 From 50e21a89a0009813b9f090288b22c64c5cefbd58 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 27 Nov 2018 15:10:40 +0000 Subject: Suggests issues when typing title This suggests possibly related issues when the user types a title. This uses GraphQL to allow the frontend to request the exact data that is requires. We also get free caching through the Vue Apollo plugin. With this we can include the ability to import .graphql files in JS and Vue files. Also we now have the Vue test utils library to make testing Vue components easier. Closes #22071 --- config/webpack.config.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/webpack.config.js b/config/webpack.config.js index 9ecae9790fd..b9044e13f50 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -84,7 +84,7 @@ module.exports = { }, resolve: { - extensions: ['.js'], + extensions: ['.js', '.gql', '.graphql'], alias: { '~': path.join(ROOT_PATH, 'app/assets/javascripts'), emojis: path.join(ROOT_PATH, 'fixtures/emojis'), @@ -100,6 +100,11 @@ module.exports = { module: { strictExportPresence: true, rules: [ + { + type: 'javascript/auto', + test: /\.mjs$/, + use: [], + }, { test: /\.js$/, exclude: path => /node_modules|vendor[\\/]assets/.test(path) && !/\.vue\.js/.test(path), @@ -121,6 +126,11 @@ module.exports = { ].join('|'), }, }, + { + test: /\.(graphql|gql)$/, + exclude: /node_modules/, + loader: 'graphql-tag/loader', + }, { test: /\.svg$/, loader: 'raw-loader', -- cgit v1.2.3 From 6ddefe7cada5268469561c70a8557cf1545684b2 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Thu, 22 Nov 2018 16:17:08 +0000 Subject: Correctly handle data-loss scenarios when encrypting columns If the EncryptColumns background migration runs in a sidekiq with a stale view of the database schema, or when the purported destination columns don't actually exist, data loss can result. Attempt to work around these issues by reloading schema information before running the migration, and raising errors if the model reports that any of its source or destination columns are missing. --- .../attr_encrypted_no_db_connection.rb | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'config') diff --git a/config/initializers/attr_encrypted_no_db_connection.rb b/config/initializers/attr_encrypted_no_db_connection.rb index e007666b852..7ad458929db 100644 --- a/config/initializers/attr_encrypted_no_db_connection.rb +++ b/config/initializers/attr_encrypted_no_db_connection.rb @@ -1,7 +1,18 @@ module AttrEncrypted module Adapters module ActiveRecord - module DBConnectionQuerier + module GitlabMonkeyPatches + # Prevent attr_encrypted from defining virtual accessors for encryption + # data when the code and schema are out of sync. See this issue for more + # details: https://github.com/attr-encrypted/attr_encrypted/issues/332 + def attribute_instance_methods_as_symbols_available? + false + end + + # Prevent attr_encrypted from checking out a database connection + # indefinitely. The result of this method is only used when the former + # is true, but it is called unconditionally, so there is still value to + # ensuring the connection is released def attribute_instance_methods_as_symbols # Use with_connection so the connection doesn't stay pinned to the thread. connected = ::ActiveRecord::Base.connection_pool.with_connection(&:active?) rescue false @@ -15,7 +26,16 @@ module AttrEncrypted end end end - prepend DBConnectionQuerier end end end + +# As of v3.1.0, the attr_encrypted gem defines the AttrEncrypted and +# AttrEncrypted::Adapters::ActiveRecord modules, and uses "extend" to mix them +# into the ActiveRecord::Base class. This intervention overrides utility methods +# defined by attr_encrypted to fix two bugs, as detailed above. +# +# The methods are used here: https://github.com/attr-encrypted/attr_encrypted/blob/3.1.0/lib/attr_encrypted.rb#L145-158 +ActiveSupport.on_load(:active_record) do + extend AttrEncrypted::Adapters::ActiveRecord::GitlabMonkeyPatches +end -- cgit v1.2.3