From d229d5a96f1e2a34479f946af90140e95754ddbb Mon Sep 17 00:00:00 2001 From: David Jay Date: Fri, 9 Dec 2016 19:28:19 -0500 Subject: [PATCH] Updating route to davidjay. --- client/coral-admin/src/actions/community.js | 6 +++--- client/coral-admin/src/services/talk-adapter.js | 2 +- client/coral-framework/actions/auth.js | 2 +- client/coral-framework/actions/user.js | 2 +- models/user.js | 2 +- routes/api/index.js | 2 +- routes/api/{user => users}/index.js | 0 tests/routes/api/user/index.js | 4 ++-- views/password-reset.ejs | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) rename routes/api/{user => users}/index.js (100%) diff --git a/client/coral-admin/src/actions/community.js b/client/coral-admin/src/actions/community.js index 24c1b403d..c4712835a 100644 --- a/client/coral-admin/src/actions/community.js +++ b/client/coral-admin/src/actions/community.js @@ -14,7 +14,7 @@ import coralApi from '../../../coral-framework/helpers/response'; export const fetchCommenters = (query = {}) => dispatch => { dispatch(requestFetchCommenters()); - coralApi(`/user?${qs.stringify(query)}`) + coralApi(`/users?${qs.stringify(query)}`) .then(({result, page, count, limit, totalPages}) => dispatch({ type: FETCH_COMMENTERS_SUCCESS, @@ -42,14 +42,14 @@ export const newPage = () => ({ }); export const setRole = (id, role) => dispatch => { - return coralApi(`/user/${id}/role`, {method: 'POST', body: {role}}) + return coralApi(`/users/${id}/role`, {method: 'POST', body: {role}}) .then(() => { return dispatch({type: SET_ROLE, id, role}); }); }; export const setCommenterStatus = (id, status) => dispatch => { - return coralApi(`/user/${id}/status`, {method: 'POST', body: {status}}) + return coralApi(`/users/${id}/status`, {method: 'POST', body: {status}}) .then(() => { return dispatch({type: SET_COMMENTER_STATUS, id, status}); }); diff --git a/client/coral-admin/src/services/talk-adapter.js b/client/coral-admin/src/services/talk-adapter.js index f734d1f72..ab542b4a0 100644 --- a/client/coral-admin/src/services/talk-adapter.js +++ b/client/coral-admin/src/services/talk-adapter.js @@ -87,7 +87,7 @@ const createComment = (store, name, comment) => { // Ban a user const userStatusUpdate = (store, status, userId, commentId) => { - return coralApi(`/user/${userId}/status`, {method: 'POST', body: {status: status, comment_id: commentId}}) + return coralApi(`/users/${userId}/status`, {method: 'POST', body: {status: status, comment_id: commentId}}) .then(res => store.dispatch({type: 'USER_BAN_SUCESS', res})) .catch(error => store.dispatch({type: 'USER_BAN_FAILED', error})); }; diff --git a/client/coral-framework/actions/auth.js b/client/coral-framework/actions/auth.js index 7ad5e4c34..d027dcd9e 100644 --- a/client/coral-framework/actions/auth.js +++ b/client/coral-framework/actions/auth.js @@ -91,7 +91,7 @@ const forgotPassowordFailure = () => ({type: actions.FETCH_FORGOT_PASSWORD_FAILU export const fetchForgotPassword = email => dispatch => { dispatch(forgotPassowordRequest(email)); - coralApi('/user/request-password-reset', {method: 'POST', body: {email}}) + coralApi('/users/request-password-reset', {method: 'POST', body: {email}}) .then(() => dispatch(forgotPassowordSuccess())) .catch(error => dispatch(forgotPassowordFailure(error))); }; diff --git a/client/coral-framework/actions/user.js b/client/coral-framework/actions/user.js index 72075e6db..cda2d765d 100644 --- a/client/coral-framework/actions/user.js +++ b/client/coral-framework/actions/user.js @@ -12,7 +12,7 @@ const saveBioFailure = error => ({type: actions.SAVE_BIO_FAILURE, error}); export const saveBio = (user_id, formData) => dispatch => { dispatch(saveBioRequest()); - coralApi(`/user/${user_id}/bio`, {method: 'PUT', body: formData}) + coralApi(`/users/${user_id}/bio`, {method: 'PUT', body: formData}) .then(({settings}) => { dispatch(addNotification('success', lang.t('successBioUpdate'))); dispatch(saveBioSuccess(settings)); diff --git a/models/user.js b/models/user.js index 2d5feff3d..857eb1260 100644 --- a/models/user.js +++ b/models/user.js @@ -607,7 +607,7 @@ UserService.addBio = (id, bio) => ( */ UserService.addAction = (item_id, user_id, action_type, field, detail) => Action.insertUserAction({ item_id, - item_type: 'comment', + item_type: 'users', user_id, action_type, field, diff --git a/routes/api/index.js b/routes/api/index.js index 2c36e86bb..7863b0cd0 100644 --- a/routes/api/index.js +++ b/routes/api/index.js @@ -16,7 +16,7 @@ router.use('/actions', authorization.needed(), require('./actions')); router.use('/auth', require('./auth')); router.use('/stream', require('./stream')); -router.use('/user', require('./user')); +router.use('/users', require('./users')); // Bind the kue handler to the /kue path. router.use('/kue', authorization.needed('admin'), require('../../kue').kue.app); diff --git a/routes/api/user/index.js b/routes/api/users/index.js similarity index 100% rename from routes/api/user/index.js rename to routes/api/users/index.js diff --git a/tests/routes/api/user/index.js b/tests/routes/api/user/index.js index 78030049b..4c0c293d0 100644 --- a/tests/routes/api/user/index.js +++ b/tests/routes/api/user/index.js @@ -10,7 +10,7 @@ chai.use(require('chai-http')); const User = require('../../../../models/user'); -describe('/api/v1/user/:user_id/actions', () => { +describe('/api/v1/users/:user_id/actions', () => { const users = [{ displayName: 'Ana', @@ -29,7 +29,7 @@ describe('/api/v1/user/:user_id/actions', () => { describe('#post', () => { it('it should update actions', () => { return chai.request(app) - .post('/api/v1/user/abc/actions') + .post('/api/v1/users/abc/actions') .set(passport.inject({id: '456', roles: ['admin']})) .send({'action_type': 'flag', 'detail': 'Bio is too awesome.'}) .then((res) => { diff --git a/views/password-reset.ejs b/views/password-reset.ejs index de23bc16d..1ffd1b554 100644 --- a/views/password-reset.ejs +++ b/views/password-reset.ejs @@ -117,7 +117,7 @@ } $.ajax({ - url: '/api/v1/user/update-password', + url: '/api/v1/users/update-password', contentType: 'application/json', method: 'POST', data: JSON.stringify({password: password, token: location.hash.replace('#', '')})