Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix is_read value in Admin notes #43096

Merged
merged 6 commits into from Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Fix `is_read` value in Admin notes.
9 changes: 5 additions & 4 deletions plugins/woocommerce/src/Admin/Notes/DataStore.php
Expand Up @@ -37,6 +37,7 @@ public function create( &$note ) {
'layout' => $note->get_layout(),
'image' => $note->get_image(),
'is_deleted' => (int) $note->get_is_deleted(),
'is_read' => (int) $note->get_is_read(),
);

$note_to_be_inserted['content_data'] = wp_json_encode( $note->get_content_data() );
Expand Down Expand Up @@ -109,7 +110,7 @@ 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_snoozable( (bool) $note_row->is_snoozable );
$note->set_is_deleted( (bool) $note_row->is_deleted );
isset( $note_row->is_read ) && $note->set_is_read( (bool) $note_row->is_read );
$note->set_layout( $note_row->layout );
Expand Down Expand Up @@ -162,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
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