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

experience.rb « in_product_marketing « message « email « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7520de6d2a3a57c4b307f4258637de9d688b6601 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# frozen_string_literal: true

module Gitlab
  module Email
    module Message
      module InProductMarketing
        class Experience < Base
          include Gitlab::Utils::StrongMemoize

          EASE_SCORE_SURVEY_ID = 1

          def subject_line
            s_('InProductMarketing|Do you have a minute?')
          end

          def tagline
          end

          def title
            s_('InProductMarketing|We want your GitLab experience to be great')
          end

          def subtitle
            s_('InProductMarketing|Take this 1-question survey!')
          end

          def body_line1
            s_('InProductMarketing|%{strong_start}Overall, how difficult or easy was it to get started with GitLab?%{strong_end}').html_safe % strong_options
          end

          def body_line2
            s_('InProductMarketing|Click on the number below that corresponds with your answer — 1 being very difficult, 5 being very easy.')
          end

          def cta_text
          end

          def feedback_link(rating)
            params = {
              onboarding_progress: onboarding_progress,
              response: rating,
              show_invite_link: show_invite_link,
              survey_id: EASE_SCORE_SURVEY_ID
            }

            params[:show_incentive] = true if show_incentive?

            "#{gitlab_com_root_url}/-/survey_responses?#{params.to_query}"
          end

          def feedback_ratings(rating)
            [
              s_('InProductMarketing|Very difficult'),
              s_('InProductMarketing|Difficult'),
              s_('InProductMarketing|Neutral'),
              s_('InProductMarketing|Easy'),
              s_('InProductMarketing|Very easy')
            ][rating - 1]
          end

          def feedback_thanks
            s_('InProductMarketing|Feedback from users like you really improves our product. Thanks for your help!')
          end

          private

          def onboarding_progress
            strong_memoize(:onboarding_progress) do
              group.onboarding_progress.number_of_completed_actions
            end
          end

          def show_invite_link
            strong_memoize(:show_invite_link) do
              group.max_member_access_for_user(user) >= GroupMember::DEVELOPER && user.preferred_language == 'en'
            end
          end

          def show_incentive?
            show_invite_link && group.member_count > 1
          end

          def gitlab_com_root_url
            return root_url.chomp('/') if Rails.env.development?

            Gitlab::Saas.com_url
          end
        end
      end
    end
  end
end