Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
184ae277
Commit
184ae277
authored
Apr 22, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add survey responses landing page
For in-app message surveys, add a landing page for tracking responses
parent
baa0c3d7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
116 additions
and
0 deletions
+116
-0
config/routes.rb
config/routes.rb
+3
-0
ee/app/controllers/survey_responses_controller.rb
ee/app/controllers/survey_responses_controller.rb
+35
-0
ee/app/views/survey_responses/index.html.haml
ee/app/views/survey_responses/index.html.haml
+11
-0
ee/changelogs/unreleased/add-survey-response-landing-page.yml
...hangelogs/unreleased/add-survey-response-landing-page.yml
+5
-0
ee/spec/controllers/survey_responses_controller_spec.rb
ee/spec/controllers/survey_responses_controller_spec.rb
+42
-0
ee/spec/features/survey_responses_spec.rb
ee/spec/features/survey_responses_spec.rb
+11
-0
locale/gitlab.pot
locale/gitlab.pot
+9
-0
No files found.
config/routes.rb
View file @
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?
...
...
ee/app/controllers/survey_responses_controller.rb
0 → 100644
View file @
184ae277
# 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
ee/app/views/survey_responses/index.html.haml
0 → 100644
View file @
184ae277
-
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.'
)
ee/changelogs/unreleased/add-survey-response-landing-page.yml
0 → 100644
View file @
184ae277
---
title
:
Survey Responses landing page
merge_request
:
29951
author
:
type
:
added
ee/spec/controllers/survey_responses_controller_spec.rb
0 → 100644
View file @
184ae277
# 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
ee/spec/features/survey_responses_spec.rb
0 → 100644
View file @
184ae277
# 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
locale/gitlab.pot
View file @
184ae277
...
...
@@ -20429,6 +20429,9 @@ msgstr ""
msgid "Support page URL"
msgstr ""
msgid "Survey Response"
msgstr ""
msgid "Switch branch/tag"
msgstr ""
...
...
@@ -20710,6 +20713,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 ""
...
...
@@ -24693,6 +24699,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 ""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment