Commit Graph

8 Commits

Author SHA1 Message Date
Kevin Ansfield
5c2f25d016 Fixed "Error parsing filter" when a theme name contains . chars
no issue

- we were passing the theme name directly in the model query filter string without any surrounding `'` chars meaning we were generating invalid filters
2021-10-26 10:14:39 +01:00
Kevin Ansfield
2951da002c Added name argument to .activateTheme()
no issue

Ghost allows multiple themes with the same `name` value in `package.json` so it assigns custom names based on the file name. When syncing we were only looking at the package.json `name` value so there could be a syncing clash when swapping between active themes.

- added `name` as the first argument to `.activateTheme(name, theme)` so that the service's consumer is in control of settings sync applying to it's known theme name
2021-10-20 11:04:44 +01:00
Thibaut Patel
e5e67fe6f0 Added validation for boolean and color
refs https://github.com/TryGhost/Team/issues/1107
refs https://github.com/TryGhost/Team/issues/1106
2021-10-20 11:23:14 +02:00
Kevin Ansfield
7729560201 Fixed tests
- unsaved changes didn't make it into previous commit
2021-10-08 15:42:54 +01:00
Kevin Ansfield
b708c7ea67 Changed "NotFoundError" and "BadRequestError" to "ValidationError"
refs https://github.com/TryGhost/Team/issues/1104

- better matches the context of the request as we're validating known keys and valid options from multiple settings
  - "404 Not Found" didn't make sense because `/custom_theme_settings/` _does_ exist, it's just that one setting key wasn't known
  - "400 Bad Request" didn't make sense because the request was understood, it just failed validation of the setting values
2021-10-08 15:40:44 +01:00
Kevin Ansfield
88fc9c7964 Added tests for Service class, fixed error when throwing invalid option error
refs https://github.com/TryGhost/Team/issues/1104

- there was a mismatch of template options when throwing error on invalid select value meaning we were erroring but with the wrong error type and message
- added missing `lodash` dependency in package.json
2021-10-07 16:57:52 +01:00
Kevin Ansfield
dbf7d33c88 Added tests for Cache class, fixed singular .get('key') behaviour
refs https://github.com/TryGhost/Team/issues/1104

- `.get('key')` would error because it was incorrectly expecting the internal content object to contain `{key, value}` objects
- changed `.getAll()` to return a shallow copy of the internal content object so we don't leak references that can result in unexpected changes to the cache content
- changed the internal content object naming to `_content` to highlight that it's an internal/private implementation detail rather than a public API
2021-10-06 13:12:26 +01:00
Kevin Ansfield
56012f5f21 slimer new custom-theme-settings-service 2021-09-21 17:21:52 +01:00