mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Merge pull request #1363 from jgable/fixAsyncHelperContext
Fix async helpers losing proper "this" context
This commit is contained in:
commit
422403c40b
1 changed files with 1 additions and 1 deletions
|
@ -287,7 +287,7 @@ Ghost.prototype.registerAsyncThemeHelper = function (name, fn) {
|
|||
hbs.registerAsyncHelper(name, function (options, cb) {
|
||||
// Wrap the function passed in with a when.resolve so it can
|
||||
// return either a promise or a value
|
||||
when.resolve(fn(options)).then(function (result) {
|
||||
when.resolve(fn.call(this, options)).then(function (result) {
|
||||
cb(result);
|
||||
}).otherwise(function (err) {
|
||||
errors.logAndThrowError(err, "registerAsyncThemeHelper: " + name);
|
||||
|
|
Loading…
Reference in a new issue