overleaf/services/web/app/coffee/infrastructure/Features.coffee
James Allen 47ab15c39f Merge pull request #1318 from sharelatex/ja-hide-v1-dash-link
Hide link back to v1 dash after we start force exporting to v2

GitOrigin-RevId: 1221bfc3d09224b09040604e0a3f6120d63d8946
2019-01-07 11:33:25 +00:00

35 lines
1.1 KiB
CoffeeScript

Settings = require 'settings-sharelatex'
module.exports = Features =
externalAuthenticationSystemUsed: ->
Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
hasFeature: (feature) ->
switch feature
when 'homepage'
return Settings.enableHomepage
when 'registration'
return not Features.externalAuthenticationSystemUsed() or Settings.overleaf?
when 'github-sync'
return Settings.enableGithubSync
when 'git-bridge'
return Settings.enableGitBridge
when 'v1-return-message'
return Settings.accountMerge? and Settings.overleaf? and !Settings.forceImportToV2
when 'custom-togglers'
return Settings.overleaf?
when 'publish-templates'
return true
when 'view-templates'
return !Settings.overleaf?
when 'affiliations'
return Settings?.apis?.v1?.url?
when 'rich-text'
isEnabled = true # Switch to false to disable
Settings.overleaf? and isEnabled
when 'redirect-sl'
return Settings.redirectToV2?
when 'force-import-to-v2'
return Settings.forceImportToV2
else
throw new Error("unknown feature: #{feature}")