0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/test/unit
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
..
api 🎨 change how we get and set config 2016-09-20 15:59:34 +01:00
apps/subscribers/lib 🐛 subscriber: sanitize email (#8078) 2017-03-03 15:44:07 +01:00
auth 🎨 Ghost bootstrap: optimise requires (#8121) 2017-03-13 20:07:12 +00:00
config 🔥 remove imageRelPath (#7927) 2017-02-03 14:42:05 +00:00
controllers/frontend 🔥 No more availableThemes (#8085) 2017-03-02 17:53:48 +01:00
mail 🎨 Move settings cache & cleanup settings API (#8057) 2017-02-27 16:53:04 +01:00
metadata 🎨 Move settings cache & cleanup settings API (#8057) 2017-02-27 16:53:04 +01:00
middleware New fully-loaded & validated activeTheme concept (#8146) 2017-03-13 21:13:17 +01:00
models/base improvement: jshint/jscs 2016-06-17 22:59:47 +02:00
models_plugins change default order of posts (#7096) 2016-07-15 11:04:10 +01:00
scheduling Error creation (#7477) 2016-10-06 13:27:35 +01:00
server_helpers 🔥 No more availableThemes (#8085) 2017-03-02 17:53:48 +01:00
sitemap 🎨 source out url utils from ConfigManager (#7347) 2016-09-20 15:59:34 +01:00
storage add read method to local file storage 2016-11-09 11:31:56 +01:00
utils 🎨 Collect & simplify package utils (#8080) 2017-03-01 14:09:31 +01:00
api_utils_spec.js replace auto increment id's by object id (#7495) 2016-11-17 09:09:11 +00:00
apps_filters_spec.js improvement: jshint/jscs 2016-06-17 22:59:47 +02:00
apps_spec.js improvement: jshint/jscs 2016-06-17 22:59:47 +02:00
errors_spec.js 🛠 use Ignition for logging/errors (#7869) 2017-01-23 11:04:01 +00:00
exporter_spec.js 🐛 export database read settings from database (#8103) 2017-03-08 10:26:57 +00:00
filters_spec.js improvement: jshint/jscs 2016-06-17 22:59:47 +02:00
ghost_url_spec.js 🔥 remove forceAdminSSL and urlSSL, add admin url (#7937) 2017-02-03 18:13:22 +00:00
importer_spec.js feature: upload validation middleware (#7208) 2016-08-18 20:25:51 +01:00
migration_fixture_utils_spec.js Themes API activation permissions & validation (#8104) 2017-03-13 12:44:44 +01:00
migration_spec.js Themes API activation permissions & validation (#8104) 2017-03-13 12:44:44 +01:00
permissions_spec.js 🎨 configurable logging with bunyan (#7431) 2016-10-04 16:33:43 +01:00
rss_spec.js 🎨 Move settings cache & cleanup settings API (#8057) 2017-02-27 16:53:04 +01:00
server_helpers_index_spec.js improvement: jshint/jscs 2016-06-17 22:59:47 +02:00
server_helpers_template_spec.js improvement: jshint/jscs 2016-06-17 22:59:47 +02:00
server_utils_spec.js 🎨 Collect & simplify package utils (#8080) 2017-03-01 14:09:31 +01:00
showdown_client_integrated_spec.js improvement: jshint/jscs 2016-06-17 22:59:47 +02:00
slack_spec.js 🔥 remove forceAdminSSL and urlSSL, add admin url (#7937) 2017-02-03 18:13:22 +00:00
social-urls_spec.js improvement: jshint/jscs 2016-06-17 22:59:47 +02:00
themes_spec.js 🎨 🐛 Improve theme lib, middleware & error handling (#8145) 2017-03-13 17:30:35 +01:00
utils_pipeline_spec.js Update mocha to version 3.0.2 🚀 (#7165) 2016-08-11 08:51:19 +01:00
validation_spec.js 🔥 🎨 Themes & settings misc cleanup (#8061) 2017-02-27 23:30:49 +01:00
xmlrpc_spec.js 🎨 😎 config env usages (#7929) 2017-02-03 18:25:39 +00:00