mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Check in Analytics if user has already been informed about per-user TC.
This commit is contained in:
parent
8925dc5a78
commit
d69a7577f5
2 changed files with 21 additions and 1 deletions
|
@ -230,6 +230,24 @@ module.exports = ProjectController =
|
||||||
return cb(null, false)
|
return cb(null, false)
|
||||||
else
|
else
|
||||||
return cb(null, true)
|
return cb(null, true)
|
||||||
|
showPerUserTCNotice: (cb) ->
|
||||||
|
cb = underscore.once(cb)
|
||||||
|
if !user_id?
|
||||||
|
return cb()
|
||||||
|
timestamp = user_id.toString().substring(0,8)
|
||||||
|
userSignupDate = new Date( parseInt( timestamp, 16 ) * 1000 )
|
||||||
|
if userSignupDate > new Date("2018-01-01") # 8th March
|
||||||
|
# Don't show for users who registered after it was released
|
||||||
|
return cb(null, false)
|
||||||
|
timeout = setTimeout cb, 500
|
||||||
|
AnalyticsManager.getLastOccurance user_id, "shown-per-user-tc-notice", (error, event) ->
|
||||||
|
clearTimeout timeout
|
||||||
|
if error?
|
||||||
|
return cb(null, false)
|
||||||
|
else if event?
|
||||||
|
return cb(null, false)
|
||||||
|
else
|
||||||
|
return cb(null, true)
|
||||||
}, (err, results)->
|
}, (err, results)->
|
||||||
if err?
|
if err?
|
||||||
logger.err err:err, "error getting details for project page"
|
logger.err err:err, "error getting details for project page"
|
||||||
|
@ -237,7 +255,7 @@ module.exports = ProjectController =
|
||||||
project = results.project
|
project = results.project
|
||||||
user = results.user
|
user = results.user
|
||||||
subscription = results.subscription
|
subscription = results.subscription
|
||||||
showTrackChangesOnboarding = results.showTrackChangesOnboarding
|
{ showTrackChangesOnboarding, showPerUserTCNotice } = results
|
||||||
|
|
||||||
daysSinceLastUpdated = (new Date() - project.lastUpdated) /86400000
|
daysSinceLastUpdated = (new Date() - project.lastUpdated) /86400000
|
||||||
logger.log project_id:project_id, daysSinceLastUpdated:daysSinceLastUpdated, "got db results for loading editor"
|
logger.log project_id:project_id, daysSinceLastUpdated:daysSinceLastUpdated, "got db results for loading editor"
|
||||||
|
@ -280,6 +298,7 @@ module.exports = ProjectController =
|
||||||
}
|
}
|
||||||
trackChangesState: project.track_changes
|
trackChangesState: project.track_changes
|
||||||
showTrackChangesOnboarding: !!showTrackChangesOnboarding
|
showTrackChangesOnboarding: !!showTrackChangesOnboarding
|
||||||
|
showPerUserTCNotice: !!showPerUserTCNotice
|
||||||
privilegeLevel: privilegeLevel
|
privilegeLevel: privilegeLevel
|
||||||
chatUrl: Settings.apis.chat.url
|
chatUrl: Settings.apis.chat.url
|
||||||
anonymous: anonymous
|
anonymous: anonymous
|
||||||
|
|
|
@ -120,6 +120,7 @@ block requirejs
|
||||||
window.maxDocLength = #{maxDocLength};
|
window.maxDocLength = #{maxDocLength};
|
||||||
window.trackChangesState = data.trackChangesState;
|
window.trackChangesState = data.trackChangesState;
|
||||||
window.showTrackChangesOnboarding = #{!!showTrackChangesOnboarding};
|
window.showTrackChangesOnboarding = #{!!showTrackChangesOnboarding};
|
||||||
|
window.showPerUserTCNotice = #{!!showPerUserTCNotice};
|
||||||
window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)};
|
window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)};
|
||||||
window.requirejs = {
|
window.requirejs = {
|
||||||
"paths" : {
|
"paths" : {
|
||||||
|
|
Loading…
Reference in a new issue