Skip to content

Commit

Permalink
Avoid caching when getting course structure
Browse files Browse the repository at this point in the history
  • Loading branch information
merkushin committed Aug 1, 2024
1 parent a13fc40 commit 5f7ffb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-module-lesson-order
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Avoid caching when getting course structure
8 changes: 2 additions & 6 deletions includes/blocks/class-sensei-course-outline-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public function register_blocks() {
],
Sensei()->assets->src_path( 'blocks/course-outline/lesson-block' )
);

}

/**
Expand Down Expand Up @@ -174,7 +173,7 @@ public function get_block_structure() {
$context = 'edit';
}

$structure = Sensei_Course_Structure::instance( $post->ID )->get( $context );
$structure = Sensei_Course_Structure::instance( $post->ID )->get( $context, wp_using_ext_object_cache() );

$this->add_block_attributes( $structure );

Expand All @@ -183,7 +182,6 @@ public function get_block_structure() {
'attributes' => $attributes,
'blocks' => $structure,
];

}

/**
Expand Down Expand Up @@ -233,7 +231,6 @@ public function render_course_outline_block( $attributes ) {

$this->block_content = $this->course->render_course_outline_block( $outline );
return $this->block_content;

}

/**
Expand All @@ -251,7 +248,7 @@ public function frontend_notices() {
}

$course_id = $post->ID;
$structure = Sensei_Course_Structure::instance( $course_id )->get( 'view' );
$structure = Sensei_Course_Structure::instance( $course_id )->get( 'view', wp_using_ext_object_cache() );
$has_draft = $this->has_draft( $structure );
$can_edit_course = Sensei_Course::can_current_user_edit_course( $course_id );

Expand Down Expand Up @@ -333,5 +330,4 @@ public function frontend_notices() {
Sensei()->notices->add_notice( $message, 'info', 'sensei-course-outline-drafts' );
}
}

}

0 comments on commit 5f7ffb7

Please sign in to comment.