mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Refactored proxy to not take name param
no-issue This was only used as context to api methods, but those have been removed.
This commit is contained in:
parent
ca2dc1889a
commit
54ac98037b
3 changed files with 2 additions and 15 deletions
|
@ -17,7 +17,7 @@ function loadApp(name) {
|
|||
function getAppByName(name) {
|
||||
// Grab the app class to instantiate
|
||||
const AppClass = loadApp(name);
|
||||
const proxy = Proxy.getInstance(name);
|
||||
const proxy = Proxy.getInstance();
|
||||
|
||||
// Check for an actual class, otherwise just use whatever was returned
|
||||
const app = _.isFunction(AppClass) ? new AppClass(proxy) : AppClass;
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
const helpers = require('../../helpers/register');
|
||||
const common = require('../../lib/common');
|
||||
const routingService = require('../routing');
|
||||
|
||||
module.exports.getInstance = function getInstance(name) {
|
||||
if (!name) {
|
||||
throw new Error(common.i18n.t('errors.apps.mustProvideAppName.error'));
|
||||
}
|
||||
|
||||
module.exports.getInstance = function getInstance() {
|
||||
const appRouter = routingService.registry.getRouter('appRouter');
|
||||
|
||||
return {
|
||||
|
|
|
@ -16,14 +16,6 @@ describe('Apps', function () {
|
|||
});
|
||||
|
||||
describe('Proxy', function () {
|
||||
it('requires a name to be passed', function () {
|
||||
function makeWithoutName() {
|
||||
return AppProxy.getInstance();
|
||||
}
|
||||
|
||||
makeWithoutName.should.throw('Must provide an app name for api context');
|
||||
});
|
||||
|
||||
it('creates a ghost proxy', function () {
|
||||
var appProxy = AppProxy.getInstance('TestApp');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue