Merge branch 'master' into force-notification-settings

This commit is contained in:
Kim Gardner
2018-03-21 13:43:20 -04:00
committed by GitHub
5 changed files with 45 additions and 21 deletions
+32 -4
View File
@@ -42,6 +42,32 @@ const decorateContextPlugins = (context, contextPlugins) => {
);
};
/**
* Some pieces of the Context are quite complex to setup, using multiple merges
* and other lodash functions. This proxies that access such that it is only
* loaded if it is used. Helpful for a query that only uses a loader, and not a
* mutator.
*
* @param {Object} ctx the graph proxy
* @param {Function} loader the loadable component that should be proxied
*/
const createLazyContextLoader = (ctx, loader) =>
new Proxy(
{ loaded: false, data: null },
{
get: (obj, prop) => {
if (obj.loaded) {
return obj.data[prop];
}
obj.data = loader(ctx);
obj.loaded = true;
return obj.data[prop];
},
}
);
/**
* Stores the request context.
*/
@@ -61,16 +87,18 @@ class Context {
this.connectors = connectors;
// Create the loaders.
this.loaders = loaders(this);
this.loaders = createLazyContextLoader(this, loaders);
// Create the mutators.
this.mutators = mutators(this);
this.mutators = createLazyContextLoader(this, mutators);
// Decorate the plugin context.
this.plugins = decorateContextPlugins(this, contextPlugins);
this.plugins = createLazyContextLoader(this, () =>
decorateContextPlugins(this, contextPlugins)
);
// Bind the publish/subscribe to the context.
this.pubsub = getBroker();
this.pubsub = createLazyContextLoader(this, () => getBroker());
// Bind the parent context.
this.parent = ctx;
+2 -2
View File
@@ -11,7 +11,7 @@ plugin:
- Client
---
Enables sign-in via Facebook via the server side passport middleware.
Enables sign-in via Google+ via the server side passport middleware.
You will need to enable the Google+ API in the dashboard and create credentials
for a new OAuth client ID web application. The authorized JavaScript origin
@@ -26,4 +26,4 @@ Configuration:
the [Google API Console](https://console.developers.google.com/apis/).
- `TALK_GOOGLE_CLIENT_SECRET` (**required**) - The Google OAuth2 client ID for
your Google login web app. You can learn more about getting a Google Client
ID at the [Google API Console](https://console.developers.google.com/apis/).
ID at the [Google API Console](https://console.developers.google.com/apis/).
+1 -1
View File
@@ -80,7 +80,7 @@ router.post('/password/reset', async (req, res, next) => {
token,
},
subject: 'Password Reset',
to: email,
email,
});
}
+10 -10
View File
@@ -1,18 +1,18 @@
const { version } = require('../package.json');
const Logger = require('bunyan');
const { LOGGING_LEVEL, REVISION_HASH } = require('../config');
const logger = new Logger({
src: true,
name: 'talk',
version,
revision: REVISION_HASH,
level: LOGGING_LEVEL,
serializers: Logger.stdSerializers,
});
// Create the logging instance that all logger's are branched from.
function createLogger(name, traceID) {
return new Logger({
src: true,
name,
traceID,
version,
revision: REVISION_HASH,
level: LOGGING_LEVEL,
serializers: Logger.stdSerializers,
});
return logger.child({ origin: name, traceID });
}
module.exports = { createLogger };
module.exports = { logger, createLogger };
-4
View File
@@ -8239,10 +8239,6 @@ pbkdf2@^3.0.3:
safe-buffer "^5.0.1"
sha.js "^2.4.8"
pell@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/pell/-/pell-1.0.1.tgz#8f1e97165001024e5f371e0ce0b329457c847b5d"
pend@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50"