diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-09-16 17:54:17 +0200 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-09-16 17:54:17 +0200 |
commit | eb6dfdca533bc18d8e1b1bdf4d4505c41d9b9c13 (patch) | |
tree | f44b4fa5fba0f75021a5bfb144daf821585c17b8 /jsonrpc.php | |
parent | a76939066b01b9dd39ff44a8d3aa3165dc7b3eaf (diff) |
Improve API calls for comments
Diffstat (limited to 'jsonrpc.php')
-rw-r--r-- | jsonrpc.php | 17 |
1 files changed, 15 insertions, 2 deletions
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); }); |