diff options
| author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-23 12:15:16 +0000 |
|---|---|---|
| committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-23 12:15:16 +0000 |
| commit | 026ed016d068a58b2e09422135b5b78bd11f2a2b (patch) | |
| tree | f92969fad6045759b43855b7061ae85afa606dd1 | |
| parent | c4aa8e8d143532f574ba4a5eda774fa6038fefac (diff) | |
| download | gitlab-ce-026ed016d068a58b2e09422135b5b78bd11f2a2b.tar.gz | |
Add latest changes from gitlab-org/gitlab@master
| -rw-r--r-- | app/experiments/change_continuous_onboarding_link_urls_experiment.rb | 9 | ||||
| -rw-r--r-- | app/helpers/learn_gitlab_helper.rb | 8 | ||||
| -rw-r--r-- | app/models/member.rb | 9 | ||||
| -rw-r--r-- | app/models/user.rb | 24 | ||||
| -rw-r--r-- | doc/administration/object_storage.md | 6 | ||||
| -rw-r--r-- | doc/ci/yaml/index.md | 4 | ||||
| -rw-r--r-- | spec/experiments/change_continuous_onboarding_link_urls_experiment_spec.rb | 53 | ||||
| -rw-r--r-- | spec/helpers/learn_gitlab_helper_spec.rb | 13 |
8 files changed, 34 insertions, 92 deletions
diff --git a/app/experiments/change_continuous_onboarding_link_urls_experiment.rb b/app/experiments/change_continuous_onboarding_link_urls_experiment.rb deleted file mode 100644 index 680cb8eadd8..00000000000 --- a/app/experiments/change_continuous_onboarding_link_urls_experiment.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class ChangeContinuousOnboardingLinkUrlsExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass - attr_writer :namespace - - def track(action, **event_args) - super(action, **event_args.merge(namespace: @namespace)) - end -end diff --git a/app/helpers/learn_gitlab_helper.rb b/app/helpers/learn_gitlab_helper.rb index 7f8f6d77ff4..6330b8fc829 100644 --- a/app/helpers/learn_gitlab_helper.rb +++ b/app/helpers/learn_gitlab_helper.rb @@ -27,8 +27,12 @@ module LearnGitlabHelper urls_to_use = nil - experiment(:change_continuous_onboarding_link_urls) do |e| - e.namespace = project.namespace + experiment( + :change_continuous_onboarding_link_urls, + namespace: project.namespace, + actor: current_user, + sticky_to: project.namespace + ) do |e| e.use { urls_to_use = action_urls } e.try { urls_to_use = new_action_urls(project) } end diff --git a/app/models/member.rb b/app/models/member.rb index 1e2df74fe47..3521223b27c 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -235,14 +235,7 @@ class Member < ApplicationRecord end def left_join_users - users = User.arel_table - members = Member.arel_table - - member_users = members.join(users, Arel::Nodes::OuterJoin) - .on(members[:user_id].eq(users[:id])) - .join_sources - - joins(member_users) + left_outer_joins(:user) end def access_for_user_ids(user_ids) diff --git a/app/models/user.rb b/app/models/user.rb index a39da30220a..23fd8c9fc8a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -536,27 +536,15 @@ class User < ApplicationRecord end def self.with_two_factor - with_u2f_registrations = <<-SQL - EXISTS ( - SELECT * - FROM u2f_registrations AS u2f - WHERE u2f.user_id = users.id - ) OR users.otp_required_for_login = ? - OR - EXISTS ( - SELECT * - FROM webauthn_registrations AS webauthn - WHERE webauthn.user_id = users.id - ) - SQL - - where(with_u2f_registrations, true) + where(otp_required_for_login: true) + .or(where_exists(U2fRegistration.where(U2fRegistration.arel_table[:user_id].eq(arel_table[:id])))) + .or(where_exists(WebauthnRegistration.where(WebauthnRegistration.arel_table[:user_id].eq(arel_table[:id])))) end def self.without_two_factor - joins("LEFT OUTER JOIN u2f_registrations AS u2f ON u2f.user_id = users.id - LEFT OUTER JOIN webauthn_registrations AS webauthn ON webauthn.user_id = users.id") - .where("u2f.id IS NULL AND webauthn.id IS NULL AND users.otp_required_for_login = ?", false) + where + .missing(:u2f_registrations, :webauthn_registrations) + .where(otp_required_for_login: false) end # diff --git a/doc/administration/object_storage.md b/doc/administration/object_storage.md index c6490e365a5..e9e43cf2309 100644 --- a/doc/administration/object_storage.md +++ b/doc/administration/object_storage.md @@ -585,6 +585,12 @@ See the following additional guides: ## Warnings, limitations, and known issues +### Objects are not included in GitLab backups + +As noted in [our backup documentation](../raketasks/backup_restore.md), +objects are not included in GitLab backups. You can enable backups with +your object storage provider instead. + ### Use separate buckets Using separate buckets for each data type is the recommended approach for GitLab. diff --git a/doc/ci/yaml/index.md b/doc/ci/yaml/index.md index b57a2aefc6f..09068ff775a 100644 --- a/doc/ci/yaml/index.md +++ b/doc/ci/yaml/index.md @@ -1430,13 +1430,13 @@ test osx: stage: test script: make test:osx dependencies: - - build:osx + - build osx test linux: stage: test script: make test:linux dependencies: - - build:linux + - build linux deploy: stage: deploy diff --git a/spec/experiments/change_continuous_onboarding_link_urls_experiment_spec.rb b/spec/experiments/change_continuous_onboarding_link_urls_experiment_spec.rb deleted file mode 100644 index 815aaf7c397..00000000000 --- a/spec/experiments/change_continuous_onboarding_link_urls_experiment_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe ChangeContinuousOnboardingLinkUrlsExperiment, :snowplow do - before do - stub_experiments(change_continuous_onboarding_link_urls: 'control') - end - - describe '#track' do - context 'when no namespace has been set' do - it 'tracks the action as normal' do - subject.track(:some_action) - - expect_snowplow_event( - category: subject.name, - action: 'some_action', - namespace: nil, - context: [ - { - schema: 'iglu:com.gitlab/gitlab_experiment/jsonschema/1-0-0', - data: an_instance_of(Hash) - } - ] - ) - end - end - - context 'when a namespace has been set' do - let_it_be(:namespace) { create(:namespace) } - - before do - subject.namespace = namespace - end - - it 'tracks the action and merges the namespace into the event args' do - subject.track(:some_action) - - expect_snowplow_event( - category: subject.name, - action: 'some_action', - namespace: namespace, - context: [ - { - schema: 'iglu:com.gitlab/gitlab_experiment/jsonschema/1-0-0', - data: an_instance_of(Hash) - } - ] - ) - end - end - end -end diff --git a/spec/helpers/learn_gitlab_helper_spec.rb b/spec/helpers/learn_gitlab_helper_spec.rb index 9d13fc65de7..ffc2bb31b8f 100644 --- a/spec/helpers/learn_gitlab_helper_spec.rb +++ b/spec/helpers/learn_gitlab_helper_spec.rb @@ -176,6 +176,19 @@ RSpec.describe LearnGitlabHelper do ) }) end + + it 'calls experiment with expected context & options' do + allow(helper).to receive(:current_user).and_return(user) + + expect(helper).to receive(:experiment).with( + :change_continuous_onboarding_link_urls, + namespace: namespace, + actor: user, + sticky_to: namespace + ) + + learn_gitlab_data + end end end end |
