Merge pull request #133 from sharelatex/ja-homepage-hide-setting

Add in setting to control whether the site has a homepage
This commit is contained in:
James Allen 2017-11-22 11:43:41 +00:00 committed by GitHub
commit 7aed6dae59
2 changed files with 5 additions and 2 deletions

View file

@ -1,5 +1,7 @@
logger = require('logger-sharelatex') logger = require('logger-sharelatex')
Settings = require('settings-sharelatex')
_ = require('underscore') _ = require('underscore')
Features = require "../../infrastructure/Features"
Path = require "path" Path = require "path"
fs = require "fs" fs = require "fs"
@ -20,12 +22,11 @@ module.exports = HomeController =
HomeController.home(req, res) HomeController.home(req, res)
home: (req, res)-> home: (req, res)->
if homepageExists if Features.hasFeature('homepage') and homepageExists
res.render 'external/home' res.render 'external/home'
else else
res.redirect "/login" res.redirect "/login"
externalPage: (page, title) -> externalPage: (page, title) ->
return (req, res, next = (error) ->) -> return (req, res, next = (error) ->) ->
path = Path.resolve(__dirname + "/../../../views/external/#{page}.pug") path = Path.resolve(__dirname + "/../../../views/external/#{page}.pug")

View file

@ -6,6 +6,8 @@ module.exports = Features =
hasFeature: (feature) -> hasFeature: (feature) ->
switch feature switch feature
when 'homepage'
return Settings.enableHomepage
when 'registration' when 'registration'
return not Features.externalAuthenticationSystemUsed() return not Features.externalAuthenticationSystemUsed()
when 'github-sync' when 'github-sync'