Skip to content
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
31 changes: 0 additions & 31 deletions assets/js/suggested-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
19 changes: 12 additions & 7 deletions assets/js/web-components/prpl-interactive-task.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global HTMLElement */
/* global HTMLElement, prplSuggestedTask */

/**
* Register the custom web component.
Expand Down Expand Up @@ -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 );
}
}
} );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,49 @@
*
* @package Progress_Planner
*/
class Update_150 {
class Update_161 {

const VERSION = '1.5.0';
const VERSION = '1.6.1';

/**
* Run the update.
*
* @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.
*
Expand Down
2 changes: 1 addition & 1 deletion progress-planner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions views/js-templates/suggested-task.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3 style="width: 100%;">
<# if ( data.post.content.rendered !== '' ) { #>
<prpl-tooltip>
<slot name="open-icon">
<button type="button" class="prpl-suggested-task-button" data-task-id="{{ data.post.meta.prpl_task_id }}" data-task-title="{{ data.post.title.rendered }}" data-action="info" data-target="info" title="{{ data.l10n.info }}" onclick="prplSuggestedTask.runButtonAction( this );">
<button type="button" class="prpl-suggested-task-button" data-task-id="{{ data.post.meta.prpl_task_id }}" data-task-title="{{ data.post.title.rendered }}" data-action="info" data-target="info" title="{{ data.l10n.info }}">
<img src="{{ data.assets.infoIcon }}" alt="{{ data.l10n.info }}" class="icon">
<span class="screen-reader-text">{{ data.l10n.info }}</span>
</button>
Expand All @@ -53,7 +53,7 @@ <h3 style="width: 100%;">
<# if ( data.post.meta.prpl_snoozable ) { #>
<prpl-tooltip class="prpl-suggested-task-snooze">
<slot name="open-icon">
<button type="button" class="prpl-suggested-task-button" data-task-id="{{ data.post.meta.prpl_task_id }}" data-task-title="{{ data.post.title.rendered }}" data-action="snooze" data-target="snooze" title="{{ data.l10n.snooze }}" onclick="prplSuggestedTask.runButtonAction( this );">
<button type="button" class="prpl-suggested-task-button" data-task-id="{{ data.post.meta.prpl_task_id }}" data-task-title="{{ data.post.title.rendered }}" data-action="snooze" data-target="snooze" title="{{ data.l10n.snooze }}">
<img src="{{ data.assets.snoozeIcon }}" alt="{{ data.l10n.snooze }}" class="icon">
<span class="screen-reader-text">{{ data.l10n.snooze }}</span>
</button>
Expand Down
Loading