From 190aa2c0e7701e0fb0eb2b62aa6dd487897041e2 Mon Sep 17 00:00:00 2001 From: Rebecca Date: Tue, 20 Sep 2016 14:59:49 +0200 Subject: [PATCH] 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) --- website/client-old/js/services/taskServices.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/website/client-old/js/services/taskServices.js b/website/client-old/js/services/taskServices.js index 604f007fd7..9b0ee26893 100644 --- a/website/client-old/js/services/taskServices.js +++ b/website/client-old/js/services/taskServices.js @@ -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, }); };