diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cd1497c6..c1e8e2ebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ += 1.6.1 = + +Bugs we fixed: + +* "Collect your point" not closing the "Test if your website can send emails correctly" popover. +* Snooze task tooltip overaly not closing properly. + = 1.6.0 = Enhancements: diff --git a/assets/js/suggested-task.js b/assets/js/suggested-task.js index c7d25cdb5..630b4b701 100644 --- a/assets/js/suggested-task.js +++ b/assets/js/suggested-task.js @@ -436,37 +436,6 @@ prplSuggestedTask = { } switch ( action ) { - case 'snooze': - tooltipActions - .querySelector( elClass ) - ?.setAttribute( 'data-tooltip-visible', 'true' ); - break; - - case 'close-snooze': - // Close the radio group. - tooltipActions - .querySelector( - `${ elClass }.prpl-toggle-radio-group-open` - ) - ?.classList.remove( 'prpl-toggle-radio-group-open' ); - // Close the tooltip. - tooltipActions - .querySelector( `${ elClass }[data-tooltip-visible]` ) - ?.removeAttribute( 'data-tooltip-visible' ); - break; - - case 'info': - tooltipActions - .querySelector( elClass ) - ?.setAttribute( 'data-tooltip-visible', 'true' ); - break; - - case 'close-info': - tooltipActions - .querySelector( elClass ) - .removeAttribute( 'data-tooltip-visible' ); - break; - case 'move-up': case 'move-down': if ( 'move-up' === action && item.previousElementSibling ) { diff --git a/assets/js/web-components/prpl-interactive-task.js b/assets/js/web-components/prpl-interactive-task.js index a8e1a3d51..a4e16ec08 100644 --- a/assets/js/web-components/prpl-interactive-task.js +++ b/assets/js/web-components/prpl-interactive-task.js @@ -1,4 +1,4 @@ -/* global HTMLElement */ +/* global HTMLElement, prplSuggestedTask */ /** * Register the custom web component. @@ -73,17 +73,22 @@ class PrplInteractiveTask extends HTMLElement { */ completeTask() { const providerId = this.getAttribute( 'provider-id' ); - const components = document.querySelectorAll( 'prpl-suggested-task' ); + const tasks = document.querySelectorAll( + '#prpl-suggested-tasks-list .prpl-suggested-task' + ); - components.forEach( ( component ) => { - const liElement = component.querySelector( 'li' ); - if ( liElement.dataset.taskId === providerId ) { + tasks.forEach( ( taskElement ) => { + if ( taskElement.dataset.taskId === providerId ) { // Close popover. document .getElementById( 'prpl-popover-' + providerId ) .hidePopover(); - // Complete task. - component.runTaskAction( liElement.dataset.taskId, 'complete' ); + + const postId = parseInt( taskElement.dataset.postId ); + + if ( postId ) { + prplSuggestedTask.maybeComplete( postId ); + } } } ); } diff --git a/classes/update/class-update-150.php b/classes/update/class-update-161.php similarity index 81% rename from classes/update/class-update-150.php rename to classes/update/class-update-161.php index acefa9889..f874e380a 100644 --- a/classes/update/class-update-150.php +++ b/classes/update/class-update-161.php @@ -12,9 +12,9 @@ * * @package Progress_Planner */ -class Update_150 { +class Update_161 { - const VERSION = '1.5.0'; + const VERSION = '1.6.1'; /** * Run the update. @@ -22,9 +22,39 @@ class Update_150 { * @return void */ public function run() { + // Migrate the badges. + $this->migrate_badges(); + + // Migrate the tasks. $this->migrate_tasks(); } + /** + * Migrate the badges. + * + * @return void + */ + private function migrate_badges() { + // Get all badges. + $badges = \progress_planner()->get_settings()->get( 'badges', [] ); + + foreach ( $badges as $badge_id => $badge ) { + + // We are only migrating monthly badges. + if ( 0 !== strpos( $badge_id, 'monthly-' ) ) { + continue; + } + + if ( ! isset( $badges[ $badge_id ]['points'] ) ) { + // We are just adding the points to the badge, for the new data structure - 10 is the max points for a badge. + $badges[ $badge_id ]['points'] = 10 - (int) $badge['remaining']; + } + } + + // Set the badges. + \progress_planner()->get_settings()->set( 'badges', $badges ); + } + /** * Migrate the tasks. * diff --git a/progress-planner.php b/progress-planner.php index 55cb0c8c1..0cff6169a 100644 --- a/progress-planner.php +++ b/progress-planner.php @@ -9,7 +9,7 @@ * Description: A plugin to help you fight procrastination and get things done. * Requires at least: 6.6 * Requires PHP: 7.4 - * Version: 1.6.0 + * Version: 1.6.1 * Author: Team Emilia Projects * Author URI: https://prpl.fyi/about * License: GPL-3.0+ diff --git a/readme.txt b/readme.txt index 993fdcdea..d4e597fc6 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: planning, maintenance, writing, blogging Requires at least: 6.3 Tested up to: 6.8 Requires PHP: 7.4 -Stable tag: 1.6.0 +Stable tag: 1.6.1 License: GPL3+ License URI: https://www.gnu.org/licenses/gpl-3.0.en.html @@ -110,6 +110,12 @@ https://youtu.be/e1bmxZYyXFY == Changelog == += 1.6.1 = + +Bugs we fixed: + +* "Collect your point" not closing the "Test if your website can send emails correctly" popover. + = 1.6.0 = Enhancements: diff --git a/views/js-templates/suggested-task.html b/views/js-templates/suggested-task.html index bc95f8a0a..b8ecdfe06 100644 --- a/views/js-templates/suggested-task.html +++ b/views/js-templates/suggested-task.html @@ -29,7 +29,7 @@

<# if ( data.post.content.rendered !== '' ) { #> - @@ -53,7 +53,7 @@

<# if ( data.post.meta.prpl_snoozable ) { #> -