Updating a task now sends only data that's actually needed (Fixes #7846) (#8040)

* Updating a task now sends only data that's actually needed (Fixes #7846)

Updating a task with a huge history lead to 'request entity too large' errors since the client attempted to send all data associated with a task, regardless of whether that data could be changed or not. With this change, the post request is now omitting the following fields:

challenge
completed
createdAt
group
history
id
reminders
tags
type
updatedAt
userId

* Changes according to review (use _.omit)
This commit is contained in:
Rebecca
2016-09-20 14:59:49 +02:00
committed by Blade Barringer
parent fb8ec7677c
commit 190aa2c0e7
@@ -72,10 +72,16 @@ angular.module('habitrpg')
};
function updateTask (taskId, taskDetails) {
var taskDetailsToSend = _.omit(
taskDetails,
['challenge', 'completed', 'createdAt', 'group', 'history', 'id',
'reminders', 'tags', 'type', 'updatedAt', 'userId']
)
return $http({
method: 'PUT',
url: '/api/v3/tasks/' + taskId,
data: taskDetails,
data: taskDetailsToSend,
});
};