mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
Merge pull request #2165 from halfdan/2157-fix-filters
Fix for broken filters where this context was lost.
This commit is contained in:
commit
0dea6a2754
2 changed files with 10 additions and 10 deletions
|
@ -6,12 +6,12 @@ var _ = require('lodash'),
|
|||
var proxy = {
|
||||
|
||||
filters: {
|
||||
register: filters.registerFilter,
|
||||
unregister: filters.unregisterFilter
|
||||
register: filters.registerFilter.bind(filters),
|
||||
unregister: filters.unregisterFilter.bind(filters)
|
||||
},
|
||||
helpers: {
|
||||
register: helpers.registerThemeHelper,
|
||||
registerAsync: helpers.registerAsyncThemeHelper
|
||||
register: helpers.registerThemeHelper.bind(helpers),
|
||||
registerAsync: helpers.registerAsyncThemeHelper.bind(helpers)
|
||||
},
|
||||
api: {
|
||||
posts: _.pick(api.posts, 'browse', 'read'),
|
||||
|
@ -21,4 +21,4 @@ var proxy = {
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = proxy;
|
||||
module.exports = proxy;
|
||||
|
|
|
@ -56,12 +56,12 @@ describe('Apps', function () {
|
|||
describe('Proxy', function () {
|
||||
it('creates a ghost proxy', function () {
|
||||
should.exist(appProxy.filters);
|
||||
appProxy.filters.register.should.equal(filters.registerFilter);
|
||||
appProxy.filters.unregister.should.equal(filters.unregisterFilter);
|
||||
should.exist(appProxy.filters.register);
|
||||
should.exist(appProxy.filters.unregister);
|
||||
|
||||
should.exist(appProxy.helpers);
|
||||
appProxy.helpers.register.should.equal(helpers.registerThemeHelper);
|
||||
appProxy.helpers.registerAsync.should.equal(helpers.registerAsyncThemeHelper);
|
||||
should.exist(appProxy.helpers.register);
|
||||
should.exist(appProxy.helpers.registerAsync);
|
||||
|
||||
should.exist(appProxy.api);
|
||||
|
||||
|
@ -189,4 +189,4 @@ describe('Apps', function () {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue