Skip to content

Commit

Permalink
Merge pull request wp-erp#703 from hasinur1997/develop
Browse files Browse the repository at this point in the history
Fix: Note api update
  • Loading branch information
rafsuntaskin authored Sep 27, 2018
2 parents 9031cc5 + 815c098 commit c7a023a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/hrm/includes/api/class-employees-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ public function get_notes( $request ) {
foreach ( $notes as $note ) {
$user = get_user_by( 'id', $note->comment_by );
$note->comment_by_display_name = $user->display_name;
$note->comment_by_avatar_url = get_avatar_url( $user->comment_by );
$note->comment_by_avatar_url = get_avatar_url( $note->comment_by );
}

$total = $employee->get_erp_user()->notes()->count();
Expand All @@ -1272,7 +1272,7 @@ public function create_note( $request ) {
return new WP_Error( 'rest_invalid_employee_id', __( 'Invalid Employee id.' ), array( 'status' => 404 ) );
}
$note = $employee->add_note( $request['note'], null, true );

$note->comment_by_avatar_url = get_avatar_url( $note->comment_by );
$request->set_param( 'context', 'edit' );
$response = rest_ensure_response( $note );
$response->set_status( 201 );
Expand All @@ -1291,8 +1291,9 @@ public function create_note( $request ) {
* @return WP_REST_Response|WP_Error
*/
public function delete_note( $request ) {

$employee_id = (int) $request['user_id'];
$note_id = (int) $request['id'];
$note_id = (int) $request['note_id'];
$employee = new Employee( $employee_id );

if ( ! $employee->is_employee() ) {
Expand Down

0 comments on commit c7a023a

Please sign in to comment.