Skip to content

Commit

Permalink
Fix boolean typecasting in DataStore and Note classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Simran authored and andfinally committed Mar 11, 2024
1 parent afccf45 commit e97383b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions plugins/woocommerce/src/Admin/Notes/DataStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public function read( &$note ) {
$note->set_source( $note_row->source );
$note->set_date_created( $note_row->date_created );
$note->set_date_reminder( $note_row->date_reminder );
$note->set_is_snoozable( $note_row->is_snoozable );
$note->set_is_deleted( $note_row->is_deleted );
isset( $note_row->is_read ) && $note->set_is_read( $note_row->is_read );
$note->set_is_snoozable( (bool) $note_row->is_snoozable );
$note->set_is_deleted( (bool) $note_row->is_deleted );
$note->set_is_read( (bool) $note_row->is_read );
$note->set_layout( $note_row->layout );
$note->set_image( $note_row->image );
$this->read_actions( $note );
Expand Down Expand Up @@ -163,11 +163,11 @@ public function update( &$note ) {
'source' => $note->get_source(),
'date_created' => $date_created_to_db,
'date_reminder' => $date_reminder_to_db,
'is_snoozable' => $note->get_is_snoozable(),
'is_snoozable' => (int) $note->get_is_snoozable(),
'layout' => $note->get_layout(),
'image' => $note->get_image(),
'is_deleted' => $note->get_is_deleted(),
'is_read' => $note->get_is_read(),
'is_deleted' => (int) $note->get_is_deleted(),
'is_read' => (int) $note->get_is_read(),
),
array( 'note_id' => $note->get_id() )
);
Expand Down
4 changes: 2 additions & 2 deletions plugins/woocommerce/src/Admin/Notes/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public function get_image( $context = 'view' ) {
* Get deleted status.
*
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return array
* @return bool
*/
public function get_is_deleted( $context = 'view' ) {
return $this->get_prop( 'is_deleted', $context );
Expand All @@ -349,7 +349,7 @@ public function get_is_deleted( $context = 'view' ) {
* Get is_read status.
*
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return array
* @return bool
*/
public function get_is_read( $context = 'view' ) {
return $this->get_prop( 'is_read', $context );
Expand Down

0 comments on commit e97383b

Please sign in to comment.