From 2c2541e7be3930ee6ac233dee5e306626729787e Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 10 Feb 2017 10:59:59 -0700 Subject: [PATCH] Added fix for not logged in user --- errors.js | 1 + graph/mutators/action.js | 5 +++-- graph/mutators/comment.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/errors.js b/errors.js index 7ee932c96..7debe6a43 100644 --- a/errors.js +++ b/errors.js @@ -121,6 +121,7 @@ const ErrInvalidAssetURL = new APIError('asset_url is invalid', { // ErrNotAuthorized is an error that is returned in the event an operation is // deemed not authorized. const ErrNotAuthorized = new APIError('not authorized', { + translation_key: 'NOT_AUTHORIZED', status: 401 }); diff --git a/graph/mutators/action.js b/graph/mutators/action.js index 12decd8cb..3499719e1 100644 --- a/graph/mutators/action.js +++ b/graph/mutators/action.js @@ -1,6 +1,7 @@ const ActionModel = require('../../models/action'); const ActionsService = require('../../services/actions'); const UsersService = require('../../services/users'); +const errors = require('../../errors'); /** * Creates an action on a item. If the item is a user flag, sets the user's status to @@ -59,8 +60,8 @@ module.exports = (context) => { return { Action: { - create: () => {}, - delete: () => {} + create: () => Promise.reject(errors.ErrNotAuthorized), + delete: () => Promise.reject(errors.ErrNotAuthorized) } }; }; diff --git a/graph/mutators/comment.js b/graph/mutators/comment.js index 3c35b0e60..2f18ae135 100644 --- a/graph/mutators/comment.js +++ b/graph/mutators/comment.js @@ -171,7 +171,7 @@ module.exports = (context) => { return { Comment: { - create: () => {} + create: () => Promise.reject(errors.ErrNotAuthorized) } }; };