From eb6dfdca533bc18d8e1b1bdf4d4505c41d9b9c13 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Tue, 16 Sep 2014 17:54:17 +0200 Subject: Improve API calls for comments --- jsonrpc.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'jsonrpc.php') diff --git a/jsonrpc.php b/jsonrpc.php index 71795a60..f7fab315 100644 --- a/jsonrpc.php +++ b/jsonrpc.php @@ -288,7 +288,14 @@ $server->register('removeCategory', function($category_id) use ($category) { /** * Comments procedures */ -$server->register('createComment', function(array $values) use ($comment) { +$server->register('createComment', function($task_id, $user_id, $content) use ($comment) { + + $values = array( + 'task_id' => $task_id, + 'user_id' => $user_id, + 'comment' => $content, + ); + list($valid,) = $comment->validateCreation($values); return $valid && $comment->create($values); }); @@ -301,7 +308,13 @@ $server->register('getAllComments', function($task_id) use ($comment) { return $comment->getAll($task_id); }); -$server->register('updateComment', function($values) use ($comment) { +$server->register('updateComment', function($id, $content) use ($comment) { + + $values = array( + 'id' => $id, + 'comment' => $content, + ); + list($valid,) = $comment->validateModification($values); return $valid && $comment->update($values); }); -- cgit v1.2.3