mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
Resolve linter issues
This commit is contained in:
@@ -116,7 +116,12 @@ class NotificationManager {
|
||||
try {
|
||||
// Pull out some useful tools.
|
||||
const {
|
||||
connectors: { models: { User }, services: { I18n: { t } } },
|
||||
connectors: {
|
||||
models: { User },
|
||||
services: {
|
||||
I18n: { t },
|
||||
},
|
||||
},
|
||||
} = ctx;
|
||||
|
||||
const organizationName = await getOrganizationName(ctx);
|
||||
|
||||
@@ -6,7 +6,10 @@ const { map, reduce } = require('lodash');
|
||||
|
||||
module.exports = connectors => {
|
||||
const {
|
||||
graph: { subscriptions: { getBroker }, Context },
|
||||
graph: {
|
||||
subscriptions: { getBroker },
|
||||
Context,
|
||||
},
|
||||
services: { Mailer, Plugins },
|
||||
} = connectors;
|
||||
|
||||
|
||||
@@ -37,7 +37,11 @@ const queueNotifications = async (ctx, userID, notifications) => {
|
||||
);
|
||||
|
||||
// Pull out some useful tools.
|
||||
const { connectors: { models: { User } } } = ctx;
|
||||
const {
|
||||
connectors: {
|
||||
models: { User },
|
||||
},
|
||||
} = ctx;
|
||||
|
||||
ctx.log.info(
|
||||
{ notifications: notifications.length, userID },
|
||||
@@ -67,7 +71,13 @@ const sendNotificationsBatch = async (ctx, notifications) => {
|
||||
map(
|
||||
notifications,
|
||||
async ({ handler, notification: { userID, context } }) => {
|
||||
const { connectors: { services: { I18n: { t } } } } = ctx;
|
||||
const {
|
||||
connectors: {
|
||||
services: {
|
||||
I18n: { t },
|
||||
},
|
||||
},
|
||||
} = ctx;
|
||||
const { category } = handler;
|
||||
|
||||
// Compose the subject for the email.
|
||||
@@ -181,7 +191,9 @@ const USER_CONFIRMATION_QUERY = `
|
||||
// returns undefined.
|
||||
const filterVerifiedNotification = ctx => async notification => {
|
||||
// Grab the user that we're supposed to be sending the notification to.
|
||||
const { notification: { userID } } = notification;
|
||||
const {
|
||||
notification: { userID },
|
||||
} = notification;
|
||||
|
||||
// Check their confirmed status. This should have already been hit by the
|
||||
// loaders, so we shouldn't make any more database requests.
|
||||
|
||||
@@ -15,7 +15,12 @@ function reduceSettings(newSettings, newValue, key) {
|
||||
* Update the user notification settings.
|
||||
*/
|
||||
async function updateNotificationSettings(ctx, settings) {
|
||||
const { connectors: { models: { User } }, user } = ctx;
|
||||
const {
|
||||
connectors: {
|
||||
models: { User },
|
||||
},
|
||||
user,
|
||||
} = ctx;
|
||||
|
||||
// Generate the settings set object, and just exit if we haven't changed
|
||||
// anything.
|
||||
@@ -29,7 +34,9 @@ async function updateNotificationSettings(ctx, settings) {
|
||||
}
|
||||
|
||||
module.exports = ctx => {
|
||||
const { connectors: { errors: ErrNotAuthorized } } = ctx;
|
||||
const {
|
||||
connectors: { errors: ErrNotAuthorized },
|
||||
} = ctx;
|
||||
|
||||
let mutators = {
|
||||
User: {
|
||||
|
||||
@@ -16,7 +16,13 @@ module.exports = {
|
||||
digestFrequency: settings => get(settings, 'digestFrequency', 'NONE'),
|
||||
},
|
||||
RootMutation: {
|
||||
async updateNotificationSettings(obj, { input }, { mutators: { User } }) {
|
||||
async updateNotificationSettings(
|
||||
obj,
|
||||
{ input },
|
||||
{
|
||||
mutators: { User },
|
||||
}
|
||||
) {
|
||||
await User.updateNotificationSettings(input);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -12,7 +12,10 @@ module.exports = router => {
|
||||
*/
|
||||
const verifyToken = (req, res, next) => {
|
||||
const {
|
||||
connectors: { secrets: { jwt }, config: { JWT_ISSUER, JWT_AUDIENCE } },
|
||||
connectors: {
|
||||
secrets: { jwt },
|
||||
config: { JWT_ISSUER, JWT_AUDIENCE },
|
||||
},
|
||||
} = req.context;
|
||||
const { token: tokenString = '' } = req.body;
|
||||
if (!tokenString) {
|
||||
@@ -50,7 +53,11 @@ module.exports = router => {
|
||||
'/api/v1/account/unsubscribe-notifications',
|
||||
verifyToken,
|
||||
async (req, res, next) => {
|
||||
const { connectors: { models: { User } } } = req.context;
|
||||
const {
|
||||
connectors: {
|
||||
models: { User },
|
||||
},
|
||||
} = req.context;
|
||||
const { user: userID } = req.token;
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
const getOrganizationName = async ctx => {
|
||||
// Grab some useful tools.
|
||||
const { loaders: { Settings } } = ctx;
|
||||
const {
|
||||
loaders: { Settings },
|
||||
} = ctx;
|
||||
|
||||
// Get the settings.
|
||||
const { organizationName = null } = await Settings.select('organizationName');
|
||||
@@ -16,7 +18,13 @@ const getOrganizationName = async ctx => {
|
||||
* @param {Mixed} context the notification context
|
||||
*/
|
||||
const getNotificationBody = async (ctx, handler, context) => {
|
||||
const { connectors: { services: { I18n: { t } } } } = ctx;
|
||||
const {
|
||||
connectors: {
|
||||
services: {
|
||||
I18n: { t },
|
||||
},
|
||||
},
|
||||
} = ctx;
|
||||
const { category, hydrate = () => [] } = handler;
|
||||
|
||||
// Get the body replacement variables for the translation key.
|
||||
|
||||
Reference in New Issue
Block a user