Skip to content

Commit

Permalink
fix(event): fixed event editing. Fixes MEMB-740
Browse files Browse the repository at this point in the history
  • Loading branch information
serge1peshcoff committed Nov 22, 2019
1 parent 8e13858 commit 06ea800
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,18 @@ exports.editEvent = async (req, res) => {
const data = req.body;
const event = req.event;

delete data.id;
delete data.status;
delete event.deleted;
delete data.deleted;

if (Object.keys(data).length === 0) {
return errors.makeValidationError(res, 'No valid field changes requested');
}

event.organizers = await Promise.all(event.organizers.map((organizer) => core.fetchUser(organizer, req.headers['x-auth-token'])));
if (Array.isArray(data.organizers)) {
data.organizers = await Promise.all(data.organizers.map(
(organizer) => core.fetchUser(organizer, req.headers['x-auth-token'])));
}

await event.update(data);

Expand Down

0 comments on commit 06ea800

Please sign in to comment.