From 9cd3f32365950f210a4ec8c2c7935e09a9538cb4 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Mon, 16 Jul 2018 14:20:53 +0100 Subject: [PATCH] Use hasFeature function instead of new standalone function --- .../app/coffee/Features/Project/ProjectController.coffee | 2 +- services/web/app/coffee/infrastructure/Features.coffee | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/services/web/app/coffee/Features/Project/ProjectController.coffee b/services/web/app/coffee/Features/Project/ProjectController.coffee index 026f55156b..301a1ed916 100644 --- a/services/web/app/coffee/Features/Project/ProjectController.coffee +++ b/services/web/app/coffee/Features/Project/ProjectController.coffee @@ -345,7 +345,7 @@ module.exports = ProjectController = themes: THEME_LIST maxDocLength: Settings.max_doc_length useV2History: !!project.overleaf?.history?.display - richTextEnabled: Features.richTextEnabled() + richTextEnabled: Features.hasFeature('rich-text') showTestControls: req.query?.tc == 'true' || user.isAdmin showPublishModal: req.query?.pm == 'true' timer.done() diff --git a/services/web/app/coffee/infrastructure/Features.coffee b/services/web/app/coffee/infrastructure/Features.coffee index 52b27a73fd..bdb68b9480 100644 --- a/services/web/app/coffee/infrastructure/Features.coffee +++ b/services/web/app/coffee/infrastructure/Features.coffee @@ -4,10 +4,6 @@ module.exports = Features = externalAuthenticationSystemUsed: -> Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth? - richTextEnabled: -> - isEnabled = true # Switch to false to disable - Settings.overleaf? and isEnabled - hasFeature: (feature) -> switch feature when 'homepage' @@ -26,5 +22,8 @@ module.exports = Features = return !Settings.overleaf? when 'affiliations' return Settings?.apis?.v1?.url? + when 'rich-text' + isEnabled = false # Switch to false to disable + Settings.overleaf? and isEnabled else throw new Error("unknown feature: #{feature}")