merge master

This commit is contained in:
riley
2017-05-16 16:33:41 -06:00
219 changed files with 3845 additions and 1847 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;
};
/**