Skip to content

Commit

Permalink
Merge pull request #1049 from alleyinteractive/release/v2.4.6
Browse files Browse the repository at this point in the history
Feature Branch for v2.4.6
  • Loading branch information
attackant authored Feb 2, 2024
2 parents 9c125ab + 3c5fd7b commit 0593d42
Show file tree
Hide file tree
Showing 28 changed files with 17,554 additions and 17,224 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/built-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
with:
node: 16
node: 20
php: '8.2'
composer_install: true
draft: false
2 changes: 1 addition & 1 deletion .github/workflows/node-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
uses: alleyinteractive/.github/.github/workflows/node-tests.yml@main
with:
ci: true
node: 16
node: 20
run-audit: false
working-directory: ./
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
2 changes: 1 addition & 1 deletion admin/apple-actions/class-action.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ abstract public function perform();
* @return mixed The value for the setting.
*/
protected function get_setting( $name ) {
return $this->settings->get( $name );
return $this->settings->__get( $name );
}
}
16 changes: 8 additions & 8 deletions admin/apple-actions/index/class-push.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private function push( $user_id = null ) {
if ( apply_filters( 'apple_news_skip_push', false, $this->id ) ) {
throw new \Apple_Actions\Action_Exception(
sprintf(
// Translators: Placeholder is a post ID.
// Translators: Placeholder is a post ID.
esc_html__( 'Skipped push of article %d due to the apple_news_skip_push filter.', 'apple-news' ),
absint( $this->id )
)
Expand Down Expand Up @@ -276,7 +276,7 @@ private function push( $user_id = null ) {
if ( array_intersect( $term_ids, $skip_term_ids ) ) {
throw new \Apple_Actions\Action_Exception(
sprintf(
// Translators: Placeholder is a post ID.
// Translators: Placeholder is a post ID.
esc_html__( 'Skipped push of article %d due to the presence of a skip push taxonomy term.', 'apple-news' ),
absint( $this->id )
)
Expand Down Expand Up @@ -392,7 +392,7 @@ private function push( $user_id = null ) {
if ( $this->is_post_in_sync( $json, $meta, $bundles ) ) {
throw new \Apple_Actions\Action_Exception(
sprintf(
// Translators: Placeholder is a post ID.
// Translators: Placeholder is a post ID.
esc_html__( 'Skipped push of article %d to Apple News because it is already in sync.', 'apple-news' ),
$this->id // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
)
Expand Down Expand Up @@ -462,7 +462,7 @@ private function push( $user_id = null ) {
if ( $remote_id ) {
Admin_Apple_Notice::success(
sprintf(
// translators: token is the post title.
// translators: token is the post title.
__( 'Article %s has been successfully updated on Apple News!', 'apple-news' ),
$post->post_title
),
Expand All @@ -471,7 +471,7 @@ private function push( $user_id = null ) {
} else {
Admin_Apple_Notice::success(
sprintf(
// translators: token is the post title.
// translators: token is the post title.
__( 'Article %s has been pushed successfully to Apple News!', 'apple-news' ),
$post->post_title
),
Expand Down Expand Up @@ -506,13 +506,13 @@ private function process_errors( $errors ) {

if ( 'warn' === $component_alerts ) {
$alert_message .= sprintf(
// translators: token is a list of component names.
// translators: token is a list of component names.
__( 'The following components are unsupported by Apple News and were removed: %s', 'apple-news' ),
$component_names
);
} elseif ( 'fail' === $component_alerts ) {
$alert_message .= sprintf(
// translators: token is a list of component names.
// translators: token is a list of component names.
__( 'The following components are unsupported by Apple News and prevented publishing: %s', 'apple-news' ),
$component_names
);
Expand All @@ -538,7 +538,7 @@ private function process_errors( $errors ) {
// Throw an exception.
throw new \Apple_Actions\Action_Exception( esc_html( $alert_message ) );
} elseif ( 'warn' === $component_alerts && ! empty( $errors[0]['component_errors'] ) ) {
\Admin_Apple_Notice::error( $alert_message, $user_id );
\Admin_Apple_Notice::error( $alert_message, $user_id );
}
}

Expand Down
6 changes: 4 additions & 2 deletions admin/class-admin-apple-themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static function render_field( $theme, $option_name ) {
* Return a Theme object loaded with db values based on the theme name string.
*
* @param string $theme_str The name of theme.
*
*
* @return \Apple_Exporter\Theme $theme_object A Theme object loaded with db config.
*/
public static function get_theme_by_name( $theme_str ) {
Expand Down Expand Up @@ -574,7 +574,9 @@ public function theme_nag() {
__( 'It looks like you are using the default theme. You can choose a new theme or customize your theme on the %1$sthemes page%2$s.', 'apple-news' ),
'<a href="' . esc_url( admin_url( 'admin.php?page=apple-news-themes' ) ) . '">',
'</a>'
)
),
get_current_user_id(),
true
);
}

Expand Down
2 changes: 1 addition & 1 deletion apple-news.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Plugin Name: Publish to Apple News
* Plugin URI: http://github.com/alleyinteractive/apple-news
* Description: Export and sync posts to Apple format.
* Version: 2.4.5
* Version: 2.4.6
* Author: Alley
* Author URI: https://alley.com
* Text Domain: apple-news
Expand Down
6 changes: 4 additions & 2 deletions assets/js/admin-settings/frontend.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import ReactDOM from 'react-dom';
// Components.
import AdminSettings from './index';

ReactDOM.render(
const container = document.getElementById('apple-news-options__page');
const root = ReactDOM.createRoot(container);

root.render(
<StrictMode>
<AdminSettings />
</StrictMode>,
document.getElementById('apple-news-options__page'),
);
4 changes: 2 additions & 2 deletions assets/js/admin-settings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import useSiteOptions from '../services/hooks/use-site-options';
import deleteAtIndex from '../util/delete-at-index';
import updateValueAtIndex from '../util/update-value-at-index';

const AdminSettings = () => {
function AdminSettings() {
const [{
loading, setSettings, saving, settings,
}, saveSettings] = useSiteOptions();
Expand Down Expand Up @@ -141,6 +141,6 @@ const AdminSettings = () => {
</div>
</div>
);
};
}

export default AdminSettings;
6 changes: 3 additions & 3 deletions assets/js/admin-settings/rule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import React from 'react';
// Components.
import TermSelector from '../components/term-selector';

const Rule = ({
function Rule({
busy,
field,
onDelete,
Expand All @@ -21,7 +21,7 @@ const Rule = ({
taxonomy,
termId,
value,
}) => {
}) {
const {
fields,
sections,
Expand Down Expand Up @@ -124,7 +124,7 @@ const Rule = ({
</td>
</tr>
);
};
}

Rule.propTypes = {
busy: PropTypes.bool.isRequired,
Expand Down
38 changes: 20 additions & 18 deletions assets/js/components/icon/index.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import React from 'react';

const Icon = () => (
<svg
enableBackground="new 0 0 26.77438 26.77438"
height="26.77438px"
version="1.1"
viewBox="0 0 26.77438 26.77438"
width="26.77438px"
x="0px"
xmlns="http://www.w3.org/2000/svg"
y="0px"
>
<g>
function Icon() {
return (
<svg
enableBackground="new 0 0 26.77438 26.77438"
height="26.77438px"
version="1.1"
viewBox="0 0 26.77438 26.77438"
width="26.77438px"
x="0px"
xmlns="http://www.w3.org/2000/svg"
y="0px"
>
<g>
<g>
<path
d="M4.71813,13.5345v4.77055l0.00002,0.65257
<g>
<path
d="M4.71813,13.5345v4.77055l0.00002,0.65257
c0,0.0568-0.00002,0.11365,0.00035,0.17044c0.00025,0.04783,0.00081,0.0957,0.00209,0.14355
c0.00283,0.10423,0.00899,0.20939,0.02751,0.31251c0.01879,0.10458,0.04945,0.20193,0.0978,0.29693
c0.04756,0.0934,0.10962,0.17891,0.1837,0.253c0.07406,0.07407,0.15948,0.13619,0.25284,0.18372
Expand All @@ -42,11 +43,12 @@ const Icon = () => (
c-0.0741-0.0741-0.15947-0.1362-0.25285-0.18375c-0.09504-0.04841-0.19239-0.0791-0.297-0.09789
c-0.10299-0.01854-0.2081-0.02468-0.31226-0.02751c-0.04781-0.00125-0.09565-0.00183-0.14348-0.00211
c-0.0568-0.00035-0.1136-0.00032-0.17037-0.00032l-0.65233-0.00002H13.53452"
/>
/>
</g>
</g>
</g>
</g>
</svg>
);
</svg>
);
}

export default Icon;
14 changes: 9 additions & 5 deletions assets/js/components/term-selector/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ export default function TermSelector({

// If the debounced search term changes, search for results from the API.
useEffect(() => {
if (debouncedSearchTerm) {
(async () => {
const newSearchResults = await apiFetch({ path: `/${taxonomies[taxonomy].rest_namespace}/${taxonomies[taxonomy].rest_base}?search=${debouncedSearchTerm}` });
const fetchTermData = async () => {
if (debouncedSearchTerm) {
const newSearchResults = await apiFetch({
path: `/${taxonomies[taxonomy].rest_namespace}/${taxonomies[taxonomy].rest_base}?search=${debouncedSearchTerm}`,
});
newSearchResults.forEach((result) => termCache.set(result));
setSearchResults(newSearchResults);
})();
}
}
};

fetchTermData();
}, [debouncedSearchTerm]); // eslint-disable-line react-hooks/exhaustive-deps

return (
Expand Down
44 changes: 23 additions & 21 deletions assets/js/pluginsidebar/panels/cover-image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,34 @@ import { __ } from '@wordpress/i18n';
import PropTypes from 'prop-types';
import React from 'react';

const CoverImage = ({
function CoverImage({
coverImageCaption,
coverImageId,
onChangeCoverImageCaption,
onChangeCoverImageId,
}) => (
<PanelBody
initialOpen={false}
title={__('Cover Image', 'apple-news')}
>
<BaseControl>
<ImagePicker
onReset={() => onChangeCoverImageId(0)}
onUpdate={({ id }) => onChangeCoverImageId(id)}
value={coverImageId}
}) {
return (
<PanelBody
initialOpen={false}
title={__('Cover Image', 'apple-news')}
>
<BaseControl>
<ImagePicker
onReset={() => onChangeCoverImageId(0)}
onUpdate={({ id }) => onChangeCoverImageId(id)}
value={coverImageId}
/>
</BaseControl>
<TextareaControl
help={__('This is optional and can be left blank.', 'apple-news')}
label={__('Caption', 'apple-news')}
onChange={onChangeCoverImageCaption}
placeholder={__('Add an image caption here.', 'apple-news')}
value={coverImageCaption}
/>
</BaseControl>
<TextareaControl
help={__('This is optional and can be left blank.', 'apple-news')}
label={__('Caption', 'apple-news')}
onChange={onChangeCoverImageCaption}
placeholder={__('Add an image caption here.', 'apple-news')}
value={coverImageCaption}
/>
</PanelBody>
);
</PanelBody>
);
}

CoverImage.propTypes = {
coverImageCaption: PropTypes.string.isRequired,
Expand Down
42 changes: 22 additions & 20 deletions assets/js/pluginsidebar/panels/maturity-rating.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,30 @@ import { __ } from '@wordpress/i18n';
import PropTypes from 'prop-types';
import React from 'react';

const MaturityRating = ({
function MaturityRating({
maturityRating,
onChangeMaturityRating,
}) => (
<PanelBody
initialOpen={false}
title={__('Maturity Rating', 'apple-news')}
>
<SelectControl
help={__('Select the optional maturity rating for this post.', 'apple-news')}
label={__('Select Maturity Rating', 'apple-news')}
onChange={onChangeMaturityRating}
options={[
{ label: '', value: '' },
{ label: __('Kids', 'apple-news'), value: 'KIDS' },
{ label: __('Mature', 'apple-news'), value: 'MATURE' },
{ label: __('General', 'apple-news'), value: 'GENERAL' },
]}
value={maturityRating}
/>
</PanelBody>
);
}) {
return (
<PanelBody
initialOpen={false}
title={__('Maturity Rating', 'apple-news')}
>
<SelectControl
help={__('Select the optional maturity rating for this post.', 'apple-news')}
label={__('Select Maturity Rating', 'apple-news')}
onChange={onChangeMaturityRating}
options={[
{ label: '', value: '' },
{ label: __('Kids', 'apple-news'), value: 'KIDS' },
{ label: __('Mature', 'apple-news'), value: 'MATURE' },
{ label: __('General', 'apple-news'), value: 'GENERAL' },
]}
value={maturityRating}
/>
</PanelBody>
);
}

MaturityRating.propTypes = {
maturityRating: PropTypes.string.isRequired,
Expand Down
Loading

0 comments on commit 0593d42

Please sign in to comment.