/** * * @SWG\Api( * path="/meeting/{uuid}/chat", * description="API for meeting actions", * @SWG\Operation( * method="POST", * type="MeetingComment", * summary="Adds a comment to the live chat for the current meeting", * @SWG\Parameter( * name="uuid", * description="UUID of the meeting", * paramType="path", * required=true, * type="string" * ), * @SWG\Parameter( * name="comment", * description="The comment to be added to the meeting", * paramType="form", * required=true, * type="string" * ), * ) * ) * * Adds a comment to an existing meeting * @param string $uuid */ private function meeting_chat_add($uuid = '') { $this->load->library('form_validation'); $this->form_validation->set_rules('comment', 'Comment', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { json_error('There was a problem with your submission: ' . validation_errors(' ', ' ')); } else { $meeting = validate_meeting_uuid($uuid, true); $comment_id = $this->Meeting_Comment->add(array('comment' => $this->post('comment'), 'meeting_id' => $meeting->id, 'creator_id' => get_user_id())); $comment = $this->Meeting_Comment->load($comment_id); $this->response(decorate_meeting_comment($comment)); } }
function decorate_meeting_comments($objects) { $updated = array(); foreach ($objects as $object) { $updated[] = decorate_meeting_comment($object); } return $updated; }