initial pagination rewrite, cleanups to comment edit

This commit is contained in:
Wyatt Johnson
2017-05-11 17:27:02 -06:00
parent 5c5d014e23
commit d497ad3369
14 changed files with 721 additions and 743 deletions
+10 -10
View File
@@ -12,23 +12,23 @@ const errors = require('../../errors');
* @param {String} action_type type of the action
* @return {Promise} resolves to the action created
*/
const createAction = ({user = {}}, {item_id, item_type, action_type, group_id, metadata = {}}) => {
return ActionsService.insertUserAction({
const createAction = async ({user = {}}, {item_id, item_type, action_type, group_id, metadata = {}}) => {
let action = await ActionsService.insertUserAction({
item_id,
item_type,
user_id: user.id,
group_id,
action_type,
metadata
}).then((action) => {
if (item_type === 'USERS' && action_type === 'FLAG') {
return UsersService
.setStatus(item_id, 'PENDING')
.then(() => action);
}
return action;
});
if (item_type === 'USERS' && action_type === 'FLAG') {
// Set the user as pending if it was a user flag.
await UsersService.setStatus(item_id, 'PENDING');
}
return action;
};
/**