overleaf/services/web/app/coffee/infrastructure/Features.coffee
Timothée Alby 2421e15d7a Merge pull request #1060 from sharelatex/ja-remove-v2-banner
Remove unneeded v2 banner

GitOrigin-RevId: 972afc2bd07ab64b0dd558cf1f15c0272f575b87
2018-10-25 15:25:35 +00:00

31 lines
955 B
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 'v1-return-message'
return Settings.accountMerge? and Settings.overleaf?
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?
else
throw new Error("unknown feature: #{feature}")