Skip to content

Commit 0e21337

Browse files
release: fixes
- Fixed Action Scheduler time issue with the old method - Fixed Global Fallback image issue - Fixed Feedzy Loop button not working with Groups
2 parents 848610b + bfd76b9 commit 0e21337

File tree

6 files changed

+55
-16
lines changed

6 files changed

+55
-16
lines changed

includes/admin/feedzy-rss-feeds-import.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,10 @@ public function manage_feedzy_import_columns( $column, $post_id ) {
834834
if ( ! $next ) {
835835
$next = Feedzy_Rss_Feeds_Util_Scheduler::is_scheduled( 'feedzy_cron' );
836836
}
837-
if ( $next ) {
837+
if ( is_numeric( $next ) ) {
838838
echo wp_kses_post( human_time_diff( $next, time() ) );
839+
} elseif ( $next ) {
840+
echo esc_html__( 'in-progress', 'feedzy-rss-feeds' );
839841
}
840842
break;
841843
default:
@@ -1469,6 +1471,8 @@ private function run_job( $job, $max ) {
14691471
if ( feedzy_is_pro() ) {
14701472
$default_thumbnail = get_post_meta( $job->ID, 'default_thumbnail_id', true );
14711473
$default_thumbnail = ! empty( $default_thumbnail ) ? explode( ',', (string) $default_thumbnail ) : $global_fallback_thumbnail;
1474+
} else {
1475+
$default_thumbnail = $global_fallback_thumbnail;
14721476
}
14731477

14741478
// Note: this implementation will only work if only one of the fields is allowed to provide

includes/util/feedzy-rss-feeds-util-scheduler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ class Feedzy_Rss_Feeds_Util_Scheduler {
2828
* @return bool|int
2929
*/
3030
public static function is_scheduled( string $hook, array $args = array() ) {
31-
if ( function_exists( 'as_has_scheduled_action' ) ) {
32-
return as_has_scheduled_action( $hook, $args );
33-
}
34-
3531
if ( function_exists( 'as_next_scheduled_action' ) ) {
3632
// For older versions of AS.
3733
return as_next_scheduled_action( $hook, $args );
3834
}
35+
if ( function_exists( 'as_has_scheduled_action' ) ) {
36+
return as_has_scheduled_action( $hook, $args );
37+
}
3938

4039
return wp_next_scheduled( $hook, $args );
4140
}

includes/views/import-metabox-edit.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,9 @@ class="fz-switch-toggle" type="checkbox" value="yes"
674674
<?php echo esc_attr( $import_feed_delete_media ); ?>>
675675
<label class="feedzy-inline form-label" for="delete-attached-media"><?php esc_html_e( 'Delete attached featured image', 'feedzy-rss-feeds' ); ?></label>
676676
</div>
677-
</div>
678-
<div class="help-text">
679-
<?php echo wp_sprintf( esc_html__( 'Helpful if you want to delete attached featured image when posts are automatically deleted.', 'feedzy-rss-feeds' ) ); ?>
677+
<div class="help-text">
678+
<?php echo wp_sprintf( esc_html__( 'Helpful if you want to delete attached featured image when posts are automatically deleted.', 'feedzy-rss-feeds' ) ); ?>
679+
</div>
680680
</div>
681681
</div>
682682
</div>

js/FeedzyLoop/components/FeedControl.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/**
22
* WordPress dependencies.
33
*/
4+
import { __ } from '@wordpress/i18n';
5+
46
import { useState, useEffect, useRef } from '@wordpress/element';
57

68
const FeedControl = ({ value, options, onChange }) => {
@@ -80,7 +82,10 @@ const FeedControl = ({ value, options, onChange }) => {
8082
value={selectedOption ? selectedOption.label : inputValue}
8183
onChange={handleInputChange}
8284
onBlur={handleInputBlur}
83-
placeholder="Enter URLs or select a category"
85+
placeholder={__(
86+
'Enter URLs or select a Feed Group',
87+
'feedzy-rss-feeds'
88+
)}
8489
disabled={selectedOption !== null}
8590
className="fz-input-field"
8691
/>
@@ -89,7 +94,7 @@ const FeedControl = ({ value, options, onChange }) => {
8994
<button
9095
onClick={handleClear}
9196
className="fz-clear-button"
92-
title="Clear selection"
97+
title={__('Clear', 'feedzy-rss-feeds')}
9398
>
9499
<svg
95100
width="14"
@@ -111,6 +116,7 @@ const FeedControl = ({ value, options, onChange }) => {
111116
<button
112117
onClick={() => setIsOpen(!isOpen)}
113118
className="fz-dropdown-button"
119+
title={__('Select Feed Group', 'feedzy-rss-feeds')}
114120
>
115121
<svg
116122
width="12"

js/FeedzyLoop/placeholder.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ const BlockPlaceholder = ({ attributes, setAttributes, onSaveFeed }) => {
8282
<Button
8383
variant="primary"
8484
onClick={() => {
85-
if (
86-
attributes?.feed?.source &&
87-
attributes?.feed?.source.length > 0
88-
) {
85+
if (attributes?.feed?.source) {
8986
onSaveFeed();
9087
}
9188
}}

tests/e2e/specs/loop.spec.js

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ test.describe('Feedzy Loop', () => {
99
const POST_TITLE = `Feedzy Loop Test ${Math.floor(Math.random() * 1000)}`;
1010

1111
test('add Feedzy Loop Block', async ({ editor, page }) => {
12+
await page.goto('/wp-admin/post-new.php?post_type=feedzy_categories');
13+
await page.getByLabel('Add title').click();
14+
await page.keyboard.type('Group One');
15+
16+
await page.locator('textarea[name="feedzy_category_feed"]').click();
17+
await page.keyboard.type(FEED_URL);
18+
await page
19+
.getByRole('button', { name: 'Publish', exact: true })
20+
.click();
21+
await page.waitForTimeout(1000);
22+
1223
await page.goto('/wp-admin/post-new.php');
1324

1425
if (
@@ -36,13 +47,35 @@ test.describe('Feedzy Loop', () => {
3647
await page.getByPlaceholder('Enter URLs or select a').click();
3748
await page.keyboard.type(FEED_URL);
3849

50+
const loadFeedButton = await page.getByRole('button', {
51+
name: 'Load Feed',
52+
exact: true,
53+
});
54+
const isDisabled = await loadFeedButton.isDisabled();
55+
expect(isDisabled).toBe(false);
56+
await loadFeedButton.click();
57+
await page.waitForTimeout(1000);
58+
59+
await page.getByLabel('Display curated RSS content').click();
60+
await page.waitForTimeout(1000);
61+
62+
// Now that we have tested we can insert URL, we can test the Feed Group.
63+
64+
await page
65+
.getByLabel('Block: Feedzy Loop')
66+
.locator('div')
67+
.nth(1)
68+
.click();
69+
await page.getByRole('button', { name: 'Edit Feed' }).click();
70+
71+
await page.getByRole('button', { name: 'Select Feed Group' }).click();
72+
await page.locator('.fz-dropdown-item').first().click();
73+
3974
await page
4075
.getByRole('button', { name: 'Load Feed', exact: true })
4176
.click();
4277
await page.waitForTimeout(1000);
4378

44-
await page.getByLabel('Display curated RSS content').click();
45-
4679
await page
4780
.getByRole('button', { name: 'Publish', exact: true })
4881
.click();

0 commit comments

Comments
 (0)