Skip to content

Commit

Permalink
Merge branch 'dev' into additional-attempt-check
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhogg authored Dec 16, 2024
2 parents d95c77e + b684f6b commit 80934a6
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
significance: patch
type: fixed
links:
- "#2799"
entry: Fix for daylight savings and leap years when scheduling engagements.
6 changes: 6 additions & 0 deletions .changelogs/lesson-preview-accessibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
significance: patch
type: fixed
links:
- "#2827"
entry: Improved accessibility of the lessons listing on a course page, when a
lesson is restricted.
7 changes: 6 additions & 1 deletion assets/js/app/llms-lesson-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ LLMS.LessonPreview = {
*/
get_tooltip: function( msg ) {
var $el = $( '<div class="llms-tooltip" />' );
$el.append( '<div class="llms-tooltip-content">' + msg + '</div>' );
$el.append(
$('<div>', {
'class': 'llms-tooltip-content',
'aria-hidden': 'true'
}).text( msg )
);
return $el;
},

Expand Down
13 changes: 1 addition & 12 deletions includes/class.llms.engagements.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ private function add_actions() {
}

add_action( 'deleted_post', array( $this, 'unschedule_delayed_engagements' ), 20, 2 );

}

/**
Expand Down Expand Up @@ -208,7 +207,6 @@ private function get_engagements( $trigger_type, $related_post_id = '' ) {
* @param int $related_post_id WP_Post ID of the related post.
*/
return apply_filters( 'lifterlms_get_engagements', $results, $trigger_type, $related_post_id );

}

/**
Expand Down Expand Up @@ -249,7 +247,6 @@ protected function get_trigger_hooks() {
* @param string[] $hooks List of hook names.
*/
return apply_filters( 'lifterlms_engagement_actions', $hooks );

}

/**
Expand Down Expand Up @@ -405,7 +402,6 @@ private function parse_hook( $action, $args ) {
$parsed['related_post_id'] = $related_post_id;

return $parsed;

}

/**
Expand Down Expand Up @@ -450,7 +446,6 @@ private function parse_hook_find_trigger_type( $action, $related_post_id ) {
}

return $trigger_type;

}

/**
Expand Down Expand Up @@ -485,7 +480,6 @@ public function maybe_trigger_engagement() {
$this->trigger_engagement( $handler, $engagement->delay );

}

}

/**
Expand Down Expand Up @@ -570,7 +564,6 @@ private function parse_engagement( $engagement, $trigger_data ) {
);

return $parsed;

}

/**
Expand All @@ -594,7 +587,7 @@ private function trigger_engagement( $data, $delay ) {
if ( $delay ) {

as_schedule_single_action(
time() + ( DAY_IN_SECONDS * $delay ),
current_datetime()->modify( "+{$delay} days" )->getTimestamp(),
$data['handler_action'],
array( $data['handler_args'] ),
! empty( $data['handler_args'][3] ) ? $this->get_delayed_group_id( $data['handler_args'][3] ) : null
Expand All @@ -616,7 +609,6 @@ private function trigger_engagement( $data, $delay ) {
remove_filter( 'llms_skip_engagement_processing_checks', '__return_true' );

}

}

/**
Expand All @@ -640,7 +632,6 @@ public function unschedule_delayed_engagements( $post_id, $post = null ) {
if ( 'llms_engagement' === $post_type ) {
as_unschedule_all_actions( '', array(), $this->get_delayed_group_id( $post_id ) );
}

}

/**
Expand All @@ -660,7 +651,5 @@ public function log( $log ) {
if ( $this->debug ) {
llms_log( $log, 'engagements' );
}

}

}
6 changes: 3 additions & 3 deletions packages/llms-e2e-test-utils/src/import-course.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { clickAndWait } from './click-and-wait';

// External dependencies.
import { visitAdminPage } from '@wordpress/e2e-test-utils';
import { visitAdminPage, clickButton } from '@wordpress/e2e-test-utils';

/**
* Import a course JSON file
Expand All @@ -28,7 +28,7 @@ export async function importCourse(
await visitAdminPage( 'admin.php', 'page=llms-import' );

// Upload button
await page.click( '.llms-setting-group.top button.llms-button-primary' );
await clickButton('Upload');

const inputSelector = 'input[name="llms_import"]';
await page.waitForSelector( inputSelector );
Expand All @@ -37,7 +37,7 @@ export async function importCourse(
fileUpload.uploadFile( file );
await page.waitForTimeout( 1000 );

await clickAndWait( '#llms-import-file-submit' );
await clickButton( 'Import' );

if ( navigate ) {
await clickAndWait( '.llms-admin-notice.notice-success a' );
Expand Down
6 changes: 4 additions & 2 deletions templates/course/lesson-preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
defined( 'ABSPATH' ) || exit;

$restrictions = llms_page_restricted( $lesson->get( 'id' ), get_current_user_id() );
$data_msg = $restrictions['is_restricted'] ? ' data-tooltip-msg="' . esc_html( strip_tags( llms_get_restriction_message( $restrictions ) ) ) . '"' : '';
?>

<div class="llms-lesson-preview<?php echo esc_attr( $lesson->get_preview_classes() ); ?>">
<a class="llms-lesson-link<?php echo $restrictions['is_restricted'] ? ' llms-lesson-link-locked' : ''; ?>" href="<?php echo ( ! $restrictions['is_restricted'] ) ? esc_url( get_permalink( $lesson->get( 'id' ) ) ) : '#llms-lesson-locked'; ?>"<?php echo $restrictions['is_restricted'] ? ' data-tooltip-msg="' . esc_attr( strip_tags( llms_get_restriction_message( $restrictions ) ) ) . '"' : ''; ?>>
<a class="llms-lesson-link<?php echo $restrictions['is_restricted'] ? ' llms-lesson-link-locked' : ''; ?>" href="<?php echo ( ! $restrictions['is_restricted'] ) ? esc_url( get_permalink( $lesson->get( 'id' ) ) ) : '#llms-lesson-locked'; ?>"<?php echo $restrictions['is_restricted'] ? ' aria-disabled="true" data-tooltip-msg="' . esc_attr( strip_tags( llms_get_restriction_message( $restrictions ) ) ) . '"' : ''; ?>>

<?php if ( 'course' === get_post_type( get_the_ID() ) ) : ?>

Expand Down Expand Up @@ -79,6 +78,9 @@
</section>

<?php if ( $restrictions['is_restricted'] ) : ?>
<span class="sr-only">
<?php echo esc_attr( strip_tags( llms_get_restriction_message( $restrictions ) ) ); ?>
</span>
<?php endif; ?>

</div>
Expand Down

0 comments on commit 80934a6

Please sign in to comment.