Welcome to mirror list, hosted at ThFree Co, Russian Federation.

require_verification_for_namespace_creation_experiment.rb « experiments « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0c47f5d183c128a8bc86c3394950e18ee0d999a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true

class RequireVerificationForNamespaceCreationExperiment < ApplicationExperiment
  exclude :existing_user

  EXPERIMENT_START_DATE = Date.new(2022, 1, 31)

  def control_behavior
    false
  end

  def candidate_behavior
    true
  end

  def candidate?
    run
  end

  def record_conversion(namespace)
    return unless should_track?

    Experiment.by_name(name).record_conversion_event_for_subject(subject, namespace_id: namespace.id)
  end

  private

  def subject
    context.value[:user]
  end

  def existing_user
    return false unless user_or_actor

    user_or_actor.created_at < EXPERIMENT_START_DATE
  end
end