mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 02:23:41 -05:00
Merge pull request #10191 from overleaf/msm-new-joiner-survey
Banner to recruit new joiners for survey GitOrigin-RevId: f901818cb428f0338de55655885eb8b54e702268
This commit is contained in:
parent
b85ae6e58e
commit
b299ccf139
4 changed files with 65 additions and 3 deletions
|
@ -509,6 +509,24 @@ const ProjectController = {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
newJoinerSurveyBannerActive(cb) {
|
||||||
|
SplitTestHandler.getAssignment(
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
'new-joiner-survey-banner',
|
||||||
|
(err, assignment) => {
|
||||||
|
if (err) {
|
||||||
|
logger.warn(
|
||||||
|
{ err },
|
||||||
|
'failed to get "new-joiner-survey-banner" split test assignment'
|
||||||
|
)
|
||||||
|
cb(null, false)
|
||||||
|
} else {
|
||||||
|
cb(null, assignment.variant === 'active')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
survey(cb) {
|
survey(cb) {
|
||||||
SurveyHandler.getSurvey(userId, (err, survey) => {
|
SurveyHandler.getSurvey(userId, (err, survey) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -526,8 +544,13 @@ const ProjectController = {
|
||||||
OError.tag(err, 'error getting data for project list page')
|
OError.tag(err, 'error getting data for project list page')
|
||||||
return next(err)
|
return next(err)
|
||||||
}
|
}
|
||||||
const { notifications, user, userEmailsData, primaryEmailCheckActive } =
|
const {
|
||||||
results
|
notifications,
|
||||||
|
user,
|
||||||
|
userEmailsData,
|
||||||
|
primaryEmailCheckActive,
|
||||||
|
newJoinerSurveyBannerActive,
|
||||||
|
} = results
|
||||||
|
|
||||||
if (
|
if (
|
||||||
user &&
|
user &&
|
||||||
|
@ -656,6 +679,12 @@ const ProjectController = {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isNewJoiner =
|
||||||
|
user.signUpDate &&
|
||||||
|
Date.now() - user.signUpDate.getTime() < 1000 * 60 * 60 * 24
|
||||||
|
const shouldDisplayNewJoinerBanner =
|
||||||
|
newJoinerSurveyBannerActive && isNewJoiner
|
||||||
|
|
||||||
ProjectController._injectProjectUsers(projects, (error, projects) => {
|
ProjectController._injectProjectUsers(projects, (error, projects) => {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
return next(error)
|
return next(error)
|
||||||
|
@ -680,6 +709,7 @@ const ProjectController = {
|
||||||
showThinFooter: true, // don't show the fat footer on the projects dashboard, as there's a fixed space available
|
showThinFooter: true, // don't show the fat footer on the projects dashboard, as there's a fixed space available
|
||||||
usersBestSubscription: results.usersBestSubscription,
|
usersBestSubscription: results.usersBestSubscription,
|
||||||
survey: results.survey,
|
survey: results.survey,
|
||||||
|
shouldDisplayNewJoinerBanner,
|
||||||
}
|
}
|
||||||
|
|
||||||
const paidUser =
|
const paidUser =
|
||||||
|
|
|
@ -65,6 +65,28 @@ block content
|
||||||
) ×
|
) ×
|
||||||
|
|
||||||
.project-list-main.col-md-10.col-xs-9
|
.project-list-main.col-md-10.col-xs-9
|
||||||
|
|
||||||
|
if shouldDisplayNewJoinerBanner
|
||||||
|
.alert.alert-info(
|
||||||
|
ng-if="shouldShowNewJoinerSurvey"
|
||||||
|
)
|
||||||
|
.notification-body
|
||||||
|
strong #{translate("new_joiner_survey_text_1")}
|
||||||
|
|
|
||||||
|
span #{translate("new_joiner_survey_text_2")}
|
||||||
|
span.pull-right
|
||||||
|
a.btn.btn-sm.btn-info(
|
||||||
|
href="https://docs.google.com/forms/d/e/1FAIpQLSduwnJnerjeqeRIwvyn209mRUfoL96-USTOx7B0INBsqhR48A/viewform?usp=sf_link"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
ng-click="dismissNewJoinerSurvey()"
|
||||||
|
)
|
||||||
|
strong #{translate("take_survey")}
|
||||||
|
|
|
||||||
|
button(ng-click="dismissNewJoinerSurvey()").close
|
||||||
|
span(aria-hidden="true") ×
|
||||||
|
span.sr-only #{translate("close")}
|
||||||
|
|
||||||
include ./list/notifications
|
include ./list/notifications
|
||||||
include ./list/project-list
|
include ./list/project-list
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,13 @@ App.controller(
|
||||||
$scope.shouldShowSurveyLink = false
|
$scope.shouldShowSurveyLink = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.shouldShowNewJoinerSurvey =
|
||||||
|
localStorage('dismissed-new-joiner-survey') !== true
|
||||||
|
$scope.dismissNewJoinerSurvey = () => {
|
||||||
|
localStorage('dismissed-new-joiner-survey', true)
|
||||||
|
$scope.shouldShowNewJoinerSurvey = false
|
||||||
|
}
|
||||||
|
|
||||||
$timeout(() => recalculateProjectListHeight(), 10)
|
$timeout(() => recalculateProjectListHeight(), 10)
|
||||||
|
|
||||||
$scope.$watch(
|
$scope.$watch(
|
||||||
|
|
|
@ -1908,5 +1908,8 @@
|
||||||
"show_x_more_projects": "Show __x__ more projects",
|
"show_x_more_projects": "Show __x__ more projects",
|
||||||
"showing_x_out_of_n_projects": "Showing __x__ out of __n__ projects.",
|
"showing_x_out_of_n_projects": "Showing __x__ out of __n__ projects.",
|
||||||
"make_a_copy": "Make a copy",
|
"make_a_copy": "Make a copy",
|
||||||
"projects_list": "Projects list"
|
"projects_list": "Projects list",
|
||||||
|
"new_joiner_survey_text_1": "Are you new to Overleaf?",
|
||||||
|
"new_joiner_survey_text_2": "Tell us your first impressions for a chance to win 50 USD",
|
||||||
|
"take_survey": "Take Survey"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue