Ghost/core/server/api
Hannah Wolfe b06f03b370 New fully-loaded & validated activeTheme concept (#8146)
📡 Add debug for the 3 theme activation methods
There are 3 different ways that a theme can be activated in Ghost:

A. On boot: we load the active theme from the file system, according to the `activeTheme` setting
B. On API "activate": when an /activate/ request is triggered for a theme, we validate & change the `activeTheme` setting
C. On API "override": if uploading a theme with the same name, we override. Using a dirty hack to make this work.

A: setting is done, should load & validate + next request does mounting
B: load is done, should validate & change setting + next request does mounting
C: load, validate & setting are all done + a hack is needed to ensure the next request does mounting

 Validate w/ gscan when theme activating on boot
- use the new gscan validation validate.check() method when activating on boot

 New concept of active theme
- add ActiveTheme class
- make it possible to set a theme to be active, and to get the active theme
- call the new themes.activate() method in all 3 cases where we activate a theme

🎨 Use new activeTheme to simplify theme code
- make use of the new concept where we can, to reduce & simplify code
- use new hasPartials() method so we don't have to do file lookups
- use path & name getters to reduce use of getContentPath etc
- remove requirement on req.app.get('activeTheme') from static-theme middleware (more on this soon)

🚨 Improve theme unit tests (TODO: fix inter-dep)
- The theme unit tests are borked! They all pass because they don't test the right things.
- This improves them, but they are still dependent on each-other
- configHbsForContext tests don't pass if the activateTheme tests aren't run first
- I will fix this in a later PR
2017-03-13 21:13:17 +01:00
..
app.js Move activation to themes endpoint (#8093) 2017-03-08 10:46:03 +00:00
authentication.js 🎨 Ghost bootstrap: optimise requires (#8121) 2017-03-13 20:07:12 +00:00
clients.js Error creation (#7477) 2016-10-06 13:27:35 +01:00
configuration.js 🎨 Move settings cache & cleanup settings API (#8057) 2017-02-27 16:53:04 +01:00
db.js 🔥 🎨 No more updateSettingsCache (#8090) 2017-03-02 23:00:01 +01:00
index.js 🎨 optimisations for brute (#7867) 2017-01-23 22:44:39 +01:00
invites.js 🎨 add urlFor('admin') and increase usage of urlFor helper (#7935) 2017-02-02 18:51:35 +00:00
mail.js 🎨 😎 config env usages (#7929) 2017-02-03 18:25:39 +00:00
notifications.js replace auto increment id's by object id (#7495) 2016-11-17 09:09:11 +00:00
posts.js Error creation (#7477) 2016-10-06 13:27:35 +01:00
roles.js Refactor handlePermissions 2015-08-11 16:03:57 +02:00
schedules.js Error creation (#7477) 2016-10-06 13:27:35 +01:00
settings.js Themes API activation permissions & validation (#8104) 2017-03-13 12:44:44 +01:00
slack.js Slack integration 2016-05-08 12:49:15 +02:00
slugs.js Error creation (#7477) 2016-10-06 13:27:35 +01:00
subscribers.js Fixed issue where all only a few subscribers where exported via CSV. (#7925) 2017-02-08 11:37:09 +01:00
tags.js Error creation (#7477) 2016-10-06 13:27:35 +01:00
themes.js New fully-loaded & validated activeTheme concept (#8146) 2017-03-13 21:13:17 +01:00
upload.js feature: upload validation middleware (#7208) 2016-08-18 20:25:51 +01:00
users.js suspend user feature (#8114) 2017-03-13 12:03:26 +00:00
utils.js replace auto increment id's by object id (#7495) 2016-11-17 09:09:11 +00:00