0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00
ghost/core
Hannah Wolfe fbc23459fc
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759

- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in

The logic
- Figuring out the correct logic here has been a little tricky but essentially:
  - {{match safestring}} with a single arg, will return true for any truthy value
  - {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
  - {{match (match something) "=" true}} will therefore work for any level of nesting
  - this can result in slightly inconsistent results, but feels correct and documentable

This is documented extensively through the test cases
2021-10-14 16:29:41 +01:00
..
client@60af36f2d4 Updated Admin to v4.18.0 2021-10-08 16:00:25 +01:00
frontend Added full SafeString handling to match helper 2021-10-14 16:29:41 +01:00
server Added text as an allowed setting type 2021-10-14 15:45:47 +01:00
shared Promoted email-only feature to general availability 2021-10-07 12:08:56 +02:00
app.js
boot.js Added metric-shipping to monitor boot-time 2021-10-12 15:01:50 +01:00
bridge.js Added clarifying note to bridge 2021-09-30 15:43:39 +01:00