mirror of
https://github.com/wassname/talk.git
synced 2026-06-30 04:53:12 +08:00
Merge branch 'master' into simplify-community-page
This commit is contained in:
@@ -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});
|
||||
});
|
||||
|
||||
@@ -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}));
|
||||
};
|
||||
|
||||
@@ -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)));
|
||||
};
|
||||
|
||||
@@ -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));
|
||||
|
||||
+1
-1
@@ -607,7 +607,7 @@ UserService.addBio = (id, bio) => (
|
||||
*/
|
||||
UserService.addAction = (item_id, user_id, action_type, field, detail) => Action.insertUserAction({
|
||||
item_id,
|
||||
item_type: 'user',
|
||||
item_type: 'users',
|
||||
user_id,
|
||||
action_type,
|
||||
field,
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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('#', '')})
|
||||
|
||||
Reference in New Issue
Block a user