Commit 33b2c1fc authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'add-survey-response-landing-page' into 'master'

Landing page for in-app message surveys

Closes gitlab-org/growth/team-tasks#50

See merge request gitlab-org/gitlab!29951
parents 5c3ddecc 184ae277
......@@ -129,6 +129,9 @@ Rails.application.routes.draw do
scope '/push_from_secondary/:geo_node_id' do
draw :git_http
end
# Used for survey responses
resources :survey_responses, only: :index
end
if ENV['GITLAB_CHAOS_SECRET'] || Rails.env.development? || Rails.env.test?
......
# frozen_string_literal: true
class SurveyResponsesController < ApplicationController
include Gitlab::Tracking::ControllerConcern
SURVEY_RESPONSE_SCHEMA_URL = 'iglu:com.gitlab/survey_response/jsonschema/1-0-0'
skip_before_action :authenticate_user!
def index
track_response if Gitlab.com?
render layout: false
end
private
def track_response
data = {
survey_id: to_number(params[:survey_id]),
instance_id: to_number(params[:instance_id]),
user_id: to_number(params[:user_id]),
email: params[:email],
name: params[:name],
username: params[:username],
response: params[:response]
}.compact
track_self_describing_event(SURVEY_RESPONSE_SCHEMA_URL, data)
end
def to_number(param)
param.to_i if param&.match?(/^\d+$/)
end
end
- page_title _('Survey Response')
!!! 5
%html{ lang: I18n.locale }
= render 'layouts/head'
%body.ui-indigo.d-flex.vh-100
= render 'layouts/header/logo_with_title'
.container.pt-6.mw-100.text-center
.mt-9.mb-4= image_tag 'illustrations/subscription-success.svg'
%h2.font-weight-bold= _('Thank you for your feedback!')
%p.pt-1= _('Your response has been recorded.')
---
title: Survey Responses landing page
merge_request: 29951
author:
type: added
# frozen_string_literal: true
require 'spec_helper'
describe SurveyResponsesController do
describe 'GET #index' do
subject { get :index, params: params }
let(:params) do
{
survey_id: '1',
instance_id: 'foo',
response: 'bar',
bla: 'bla'
}
end
context 'on GitLab.com' do
before do
allow(::Gitlab).to receive(:com?).and_return(true)
end
it 'tracks a survey_response event' do
expect(controller).to receive(:track_self_describing_event).with(
SurveyResponsesController::SURVEY_RESPONSE_SCHEMA_URL,
survey_id: 1,
response: 'bar'
)
subject
end
end
context 'not on GitLab.com' do
it 'does not track a survey_response event' do
expect(controller).not_to receive(:track_self_describing_event)
subject
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe 'Responses' do
it 'Shows a friendly message' do
visit survey_responses_path
expect(page).to have_text _('Thank you for your feedback!')
end
end
......@@ -20435,6 +20435,9 @@ msgstr ""
msgid "Support page URL"
msgstr ""
msgid "Survey Response"
msgstr ""
msgid "Switch branch/tag"
msgstr ""
......@@ -20716,6 +20719,9 @@ msgstr ""
msgid "Thank you for signing up for your free trial! You will get additional instructions in your inbox shortly."
msgstr ""
msgid "Thank you for your feedback!"
msgstr ""
msgid "Thank you for your report. A GitLab administrator will look into it shortly."
msgstr ""
......@@ -24699,6 +24705,9 @@ msgstr ""
msgid "Your request for access has been queued for review."
msgstr ""
msgid "Your response has been recorded."
msgstr ""
msgid "Your search didn't match any commits."
msgstr ""
......
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