From 4f905af0782bbfbcb6967e27fd9443ab5096c4ce Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 20 Nov 2017 11:48:06 +0000 Subject: [PATCH 1/4] Add feature flag for github sync --- services/web/app/coffee/infrastructure/Features.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/web/app/coffee/infrastructure/Features.coffee b/services/web/app/coffee/infrastructure/Features.coffee index e4a8fefbe8..9bf800f55f 100644 --- a/services/web/app/coffee/infrastructure/Features.coffee +++ b/services/web/app/coffee/infrastructure/Features.coffee @@ -8,5 +8,7 @@ module.exports = Features = switch feature when 'registration' return not Features.externalAuthenticationSystemUsed() + when 'github-sync' + return not Settings.disableGithubSync else throw new Error("unknown feature: #{feature}") From 7440d8da581cf836ae5fed07fe49e59aceb7b85e Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 22 Nov 2017 10:44:57 +0000 Subject: [PATCH 2/4] Change to an 'enableGithubSync' setting --- services/web/app/coffee/infrastructure/Features.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/app/coffee/infrastructure/Features.coffee b/services/web/app/coffee/infrastructure/Features.coffee index 9bf800f55f..0a59cf931e 100644 --- a/services/web/app/coffee/infrastructure/Features.coffee +++ b/services/web/app/coffee/infrastructure/Features.coffee @@ -9,6 +9,6 @@ module.exports = Features = when 'registration' return not Features.externalAuthenticationSystemUsed() when 'github-sync' - return not Settings.disableGithubSync + return Settings.enableGithubSync else throw new Error("unknown feature: #{feature}") From dd619f44dde651e474c3447f760734681d149da9 Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 17 Nov 2017 11:55:49 +0000 Subject: [PATCH 3/4] Add in setting to control whether the site has a homepage --- .../web/app/coffee/Features/StaticPages/HomeController.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/app/coffee/Features/StaticPages/HomeController.coffee b/services/web/app/coffee/Features/StaticPages/HomeController.coffee index c1a8c46323..f2971393c4 100755 --- a/services/web/app/coffee/Features/StaticPages/HomeController.coffee +++ b/services/web/app/coffee/Features/StaticPages/HomeController.coffee @@ -1,4 +1,5 @@ logger = require('logger-sharelatex') +Settings = require('settings-sharelatex') _ = require('underscore') Path = require "path" @@ -20,12 +21,11 @@ module.exports = HomeController = HomeController.home(req, res) home: (req, res)-> - if homepageExists + if Settings.showHomepage and homepageExists res.render 'external/home' else res.redirect "/login" - externalPage: (page, title) -> return (req, res, next = (error) ->) -> path = Path.resolve(__dirname + "/../../../views/external/#{page}.pug") From 5bb06915ccd46dd43ca52710f0005b0ef0338274 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 22 Nov 2017 10:44:13 +0000 Subject: [PATCH 4/4] Rename setting and use Features.hasFeatures --- .../web/app/coffee/Features/StaticPages/HomeController.coffee | 3 ++- services/web/app/coffee/infrastructure/Features.coffee | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/StaticPages/HomeController.coffee b/services/web/app/coffee/Features/StaticPages/HomeController.coffee index f2971393c4..9a8f5ced41 100755 --- a/services/web/app/coffee/Features/StaticPages/HomeController.coffee +++ b/services/web/app/coffee/Features/StaticPages/HomeController.coffee @@ -1,6 +1,7 @@ logger = require('logger-sharelatex') Settings = require('settings-sharelatex') _ = require('underscore') +Features = require "../../infrastructure/Features" Path = require "path" fs = require "fs" @@ -21,7 +22,7 @@ module.exports = HomeController = HomeController.home(req, res) home: (req, res)-> - if Settings.showHomepage and homepageExists + if Features.hasFeature('homepage') and homepageExists res.render 'external/home' else res.redirect "/login" diff --git a/services/web/app/coffee/infrastructure/Features.coffee b/services/web/app/coffee/infrastructure/Features.coffee index 0a59cf931e..7047826bbb 100644 --- a/services/web/app/coffee/infrastructure/Features.coffee +++ b/services/web/app/coffee/infrastructure/Features.coffee @@ -6,6 +6,8 @@ module.exports = Features = hasFeature: (feature) -> switch feature + when 'homepage' + return Settings.enableHomepage when 'registration' return not Features.externalAuthenticationSystemUsed() when 'github-sync'