Commit f303b815 authored by Eugie Limpin's avatar Eugie Limpin Committed by Jan Provaznik

Update onboarding interview recruiting

parent 1cb0b760
......@@ -2,10 +2,11 @@
class SurveyResponsesController < ApplicationController
SURVEY_RESPONSE_SCHEMA_URL = 'iglu:com.gitlab/survey_response/jsonschema/1-0-1'
CALENDLY_INVITE_LINK = 'https://calendly.com/mkarampalas/gitlab-user-onboarding-research'
CALENDLY_INVITE_LINK = 'https://calendly.com/d/n9wd-sy2b/gitlab-user-onboarding-research'
before_action :track_response, only: :index
before_action :set_invite_link, only: :index
before_action :set_show_incentive, only: :index
skip_before_action :authenticate_user!
......@@ -47,4 +48,10 @@ class SurveyResponsesController < ApplicationController
@invite_link = CALENDLY_INVITE_LINK
end
def set_show_incentive
return unless @invite_link
@show_incentive = Gitlab::Utils.to_boolean(params[:show_incentive])
end
end
- page_title _('Survey Response')
- header = _('Thank you for your feedback!')
!!! 5
%html{ lang: I18n.locale }
......@@ -6,9 +7,19 @@
%body.ui-indigo.gl-display-flex
= render 'layouts/header/logo_with_title'
.container.gl-pt-8.gl-max-w-full.gl-text-center
.gl-mt-11.gl-mb-6= image_tag 'illustrations/subscription-success.svg'
%h2.gl-font-weight-bold= _('Thank you for your feedback!')
%p.gl-pt-2.gl-mb-0= _('Your response has been recorded.')
- if @invite_link
%p= _('We love speaking to our users. Got more to say about your GitLab experiences?')
%p.gl-pt-3= link_to _("Let's talk!"), @invite_link, target: '_blank', rel: 'noopener noreferrer', class: 'gl-button btn btn-confirm'
%h2.gl-font-weight-bold.gl-mt-11= header
%p= _('Have more to say about GitLab?')
.gl-display-flex.gl-justify-content-center.gl-md-max-w-30p.gl-m-auto.gl-mb-5
.gl-px-5
= image_tag 'illustrations/chat.svg', class: 'gl-mb-3'
%p= _('Have a quick chat with us about your experience.')
- if @show_incentive
.gl-px-5
= image_tag 'illustrations/gift.svg', class: 'gl-mb-3'
%p= html_escape(_('Receive a %{strongOpen}$50 gift card%{strongClose} as a thank you for your time.')) % { strongOpen: '<strong>'.html_safe, strongClose: '</strong>'.html_safe }
%p.gl-pt-2= link_to _("Let's talk!"), @invite_link, target: '_blank', rel: 'noopener noreferrer', class: 'gl-button btn btn-confirm'
- else
.gl-mt-11.gl-mb-6= image_tag 'illustrations/subscription-success.svg'
%h2.gl-font-weight-bold= header
%p= _('Your response has been recorded.')
......@@ -10,18 +10,21 @@ RSpec.describe SurveyResponsesController do
subject(:request) { get survey_responses_path(params) }
let(:ondotcom) { false }
let(:params) do
let(:default_params) do
{
survey_id: '123',
instance_id: 'foo',
response: 'response text',
bla: 'bar',
show_invite_link: 'true',
show_incentive: 'true',
onboarding_progress: '4'
}
end
let(:ondotcom) { false }
let(:params) { default_params }
describe 'tracking a snowplow event', :snowplow do
it 'does not track a survey_response event' do
request
......@@ -85,5 +88,29 @@ RSpec.describe SurveyResponsesController do
it { expect(assigns(:invite_link)).to be_nil }
end
end
describe 'show incentive' do
let(:ondotcom) { true }
let(:feature_flag_enabled) { true }
before do
stub_feature_flags(calendly_invite_link: feature_flag_enabled)
request
end
it { expect(assigns(:show_incentive)).to be true }
context "when 'show_incentive' parameter is not present in the URL" do
let(:params) { default_params.except(:show_incentive) }
it { expect(assigns(:show_incentive)).to be nil }
end
context 'when invite link is not set' do
let(:ondotcom) { false }
it { expect(assigns(:show_incentive)).to be nil }
end
end
end
end
......@@ -8,7 +8,11 @@ RSpec.describe 'survey_responses/index' do
render
expect(rendered).to have_content(_('Thank you for your feedback!'))
expect(rendered).not_to have_content(_('We love speaking to our users. Got more to say about your GitLab experiences?'))
expect(rendered).to have_content(_('Your response has been recorded.'))
expect(rendered).not_to have_content(_('Have more to say about GitLab?'))
expect(rendered).not_to have_content(_('Have a quick chat with us about your experience.'))
expect(rendered).not_to have_content(_('Receive a $50 gift card as a thank you for your time.'))
expect(rendered).not_to have_link(_("Let's talk!"))
end
......@@ -17,12 +21,29 @@ RSpec.describe 'survey_responses/index' do
assign(:invite_link, SurveyResponsesController::CALENDLY_INVITE_LINK)
end
it 'shows additional text and an invite link' do
it 'shows invitation text and link' do
render
expect(rendered).to have_content(_('Have more to say about GitLab?'))
expect(rendered).to have_content(_('Have a quick chat with us about your experience.'))
expect(rendered).to have_link(_("Let's talk!"), href: SurveyResponsesController::CALENDLY_INVITE_LINK)
expect(rendered).not_to have_content(_('Receive a $50 gift card as a thank you for your time.'))
end
context 'when @show_incentive is true' do
before do
assign(:show_incentive, true)
end
it 'shows text about the incentive' do
render
expect(rendered).to have_content(_('We love speaking to our users. Got more to say about your GitLab experiences?'))
expect(rendered).to have_content(_('Have more to say about GitLab?'))
expect(rendered).to have_content(_('Have a quick chat with us about your experience.'))
expect(rendered).to have_content(_('Receive a $50 gift card as a thank you for your time.'))
expect(rendered).to have_link(_("Let's talk!"), href: SurveyResponsesController::CALENDLY_INVITE_LINK)
end
end
end
end
end
......@@ -43,7 +43,9 @@ module Gitlab
survey_id: EASE_SCORE_SURVEY_ID
}
"#{Gitlab::Saas.com_url}/-/survey_responses?#{params.to_query}"
params[:show_incentive] = true if show_incentive?
"#{gitlab_com_root_url}/-/survey_responses?#{params.to_query}"
end
def feedback_ratings(rating)
......@@ -70,8 +72,18 @@ module Gitlab
def show_invite_link
strong_memoize(:show_invite_link) do
group.member_count > 1 && group.max_member_access_for_user(user) >= GroupMember::DEVELOPER && user.preferred_language == 'en'
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
......
......@@ -16721,6 +16721,12 @@ msgstr ""
msgid "Hashed storage can't be disabled anymore for new projects"
msgstr ""
msgid "Have a quick chat with us about your experience."
msgstr ""
msgid "Have more to say about GitLab?"
msgstr ""
msgid "Header cannot be associated with both a request and a response"
msgstr ""
......@@ -28064,6 +28070,12 @@ msgstr ""
msgid "Recaptcha verified?"
msgstr ""
msgid "Receive a $50 gift card as a thank you for your time."
msgstr ""
msgid "Receive a %{strongOpen}$50 gift card%{strongClose} as a thank you for your time."
msgstr ""
msgid "Receive alerts from manually configured Prometheus servers."
msgstr ""
......@@ -38073,9 +38085,6 @@ msgstr ""
msgid "We heard back from your device. You have been authenticated."
msgstr ""
msgid "We love speaking to our users. Got more to say about your GitLab experiences?"
msgstr ""
msgid "We recommend cloud-based mobile authenticator apps such as Authy, Duo Mobile, and LastPass. They can restore access if you lose your hardware device."
msgstr ""
......
......@@ -22,14 +22,36 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Experience do
expect(message.cta_text).to be_nil
end
describe '#feedback_link' do
let(:member_count) { 2 }
describe 'feedback URL' do
before do
allow(message).to receive(:onboarding_progress).and_return(1)
allow(message).to receive(:show_invite_link).and_return(true)
end
subject do
message.feedback_link(1)
end
it { is_expected.to start_with(Gitlab::Saas.com_url) }
context 'when in development' do
let(:root_url) { 'http://example.com' }
before do
allow(message).to receive(:root_url).and_return(root_url)
stub_rails_env('development')
end
it { is_expected.to start_with(root_url) }
end
end
describe 'feedback URL show_invite_link query param' do
let(:user_access) { GroupMember::DEVELOPER }
let(:preferred_language) { 'en' }
before do
allow(message).to receive(:onboarding_progress).and_return(1)
allow(group).to receive(:member_count).and_return(member_count)
allow(group).to receive(:max_member_access_for_user).and_return(user_access)
allow(user).to receive(:preferred_language).and_return(preferred_language)
end
......@@ -41,12 +63,6 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Experience do
it { is_expected.to eq('true') }
context 'with only one member' do
let(:member_count) { 1 }
it { is_expected.to eq('false') }
end
context 'with less than developer access' do
let(:user_access) { GroupMember::GUEST }
......@@ -59,6 +75,41 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Experience do
it { is_expected.to eq('false') }
end
end
describe 'feedback URL show_incentive query param' do
let(:show_invite_link) { true }
let(:member_count) { 2 }
let(:query) do
uri = URI.parse(message.feedback_link(1))
Rack::Utils.parse_query(uri.query).with_indifferent_access
end
before do
allow(message).to receive(:onboarding_progress).and_return(1)
allow(message).to receive(:show_invite_link).and_return(show_invite_link)
allow(group).to receive(:member_count).and_return(member_count)
end
subject { query[:show_incentive] }
it { is_expected.to eq('true') }
context 'with only one member' do
let(:member_count) { 1 }
it "is not present" do
expect(query).not_to have_key(:show_incentive)
end
end
context 'show_invite_link is false' do
let(:show_invite_link) { false }
it "is not present" do
expect(query).not_to have_key(:show_incentive)
end
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment